Zero crossings and separation of data

1 view (last 30 days)
I am currently trying to write a code that will divide each iteration of a set data that only comprises of voltage values up into separate figures/entities after the last zero crossing of each iteration as well as record the first zero crossing of each. Within the provided figure (picture), one iteration is highlighted in red. Currently the data is only 10 iterations of an experiment, but I eventually want to record over 100 iterations and process the data through a MATLAB code. Any and all help is appreciated. Thank you.
  1 Comment
Rik
Rik on 21 Oct 2020
What did you try already? Have a read here and here. It will greatly improve your chances of getting an answer.

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 21 Oct 2020
Use the envelope function to define the ‘outline’ of the upper portion of the signal (and the lower portion if you want that), then use:
zci = @(v) find(diff(sign(v)));
with ‘v’ being the envelope vector to define the indices of the zero-crossings:
env = envelope(yourSignal);
zxidx = zci(env);
then take it from there.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!