I want to find the corresponding blue and orange peak for the last oscillation.

1 view (last 30 days)
Hi there,
I have two signals oscillations and I want to find the corresponding blue and orange peak at the last oscillation. The code I am using gives me
the peaks from the start until the end however I only want the peaks that are corresponding in the last oscillation. Can anyone help please?

Answers (1)

Star Strider
Star Strider on 16 Sep 2021
LastBlue = [pks3(end) locs3(end)]
LastOrange = [pks4(end) locs4(end)]
You will need to experiment to see if those return the correct results.
Image Analyst
Image Analyst on 16 Sep 2021
@Newbie, there are lots of options with findpeaks(). Star just mentioned one of them so look into that. Granted, some of them are hard to understand. One you might want tells you how close the peaks can be to each other horizontally. Since you have a rough idea of the main peak spacing, you can set the 'MinPeakDistance' to be around 5 so it won't get a bunch of lesser peaks close by the main peak.
If you still have trouble, attach your data with the paperclip icon.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!