How can I find cross axis from set of signal data

12 views (last 30 days)
I have a set of signal(first graph) and I want to find the time of every peak of it, so I diff my data(second graph).
but I'm struggle to find each point of diff data crossing x-axis. since my signal can be pretty long and I cant set exact time boundaries between each y=0
appreciate every sugestions!
  4 Comments
Adam Danz
Adam Danz on 3 Nov 2019
That's clearer.
You can find the peaks by Star Strider's suggestion. As he notes, it may take some time to find the right properties for that algorithm to work for you. The 2nd output of that function indicates the x values of the peaks. After you get that working you can list the x values of the peaks and then you can list all x values where the your line crosses from positive to negative. The indicies circled in your plot will be the first y-crossing after each peak.

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 3 Nov 2019
If you want to find the peaks in your data (that looks like a photoplethysmogram signal), use the Signal Processing Toolbox findpeaks function, or the core MATLAB islocalmax (R2017b and later) function.
It is not necessary to take the numerical derivative (the best function for that is gradient, not diff).
  2 Comments
Star Strider
Star Strider on 3 Nov 2019
My pleasure.
Both functions have name-value pair arguments that can help you distinguish the peaks you want to identify from the peaks you want to ignore. Please post back here if you have problems.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!