Blaz
Blaz

Reputation: 67

Octave zerocrossing of two vectors

I have a question regarding zerocrossing. I have three vectors [t],[x],[y] of same length.

I would like to create a function which would search for points where [x] and [y] simultaneously make the zerocrossing. Please refer to the enclosed picture where red and blue curves intersect on the x axis. Other intersections are not interesting for me.

I have pinpointed the zerocrossing of each vector separately with indx = zerocrossing (t,x) indy = zerocrossing (t,y) . .

Now I have to crossreference both and keep only indexes where they simultaneously do the zerocrossing.

Any help is much appreciated.

Thanks

enter image description here

Upvotes: 0

Views: 162

Answers (1)

Bob
Bob

Reputation: 14654

You can use intersect

indx = zerocrossing(t, x);
indy = zerocrossing(t, y);
indxy = intersect(indx, indy);

Upvotes: 1

Related Questions