i'm trying create code this: in time series when v crossed 0 negative positive, separated @ least 4 days other 0 crossings (left , right direction), , if take 8 elements (from 0 crossings) right, @ least 80% of days positive, , if take 6 elements left (from 0 crossings), @ least 60% of days negative. series meets these conditions bookmarked or saved position.
thanks help..
v=[-1 2 3 -9 -8 -6 -7 -9 -3 -2 -5 -6 -3 1 6 8 5 9 7 4 5 6 -5 -7 2 5 3 2 -2 -1 -5 -4 1 4 3 5 6 3 4 3 -4 5]
with program can extract position when value change positive negative or vice versa.
vexample=v; vexample(vexample >= 0) = 1; vexample(vexample < 0) = -1; z = vexample > 0; id = find([true;diff(vexample.') ~= 0]); k = diff([id;numel(vexample)+1]); out = -k; out(z(id)) = k(z(id)); clear id k vexample z out = -1 2 -10 9 -2 4 -4 8 -1 1
and now, i'm trying detect part of series meets conditions, i've got problems that
to honest, think confusing , readers of question way more need to. looks proficient in matlab above code answer break down in parts.
first find indices of 0 crossings (i think that's id is?)
now can make kinda simple , eliminate indices within 4 of each other. use loop , if statements make vector of invalid (closer within 4). after loop passes through, delete those.
to honest, not clear trying in part:
if take 8 elements (from 0 crossings)to right, @ least 80% of days positive, , if take 6 elements left (from 0 crossings), @ least 60% of days negative.
but should easy enough basic if statements..
all cool programming projects done in baby steps , that's how suggest start well.
Comments
Post a Comment