How can I put additional constraints on peaks using findpeaks?
3 views (last 30 days)
Show older comments
Hello,
I need to find peaks in a signal, the peaks correspond to a certain event happening. I can isolate most of the correct peaks using findpeaks when I set a minimum separation distance, however, occasionally the spectrum has two peaks to choose from (similar to peaks 10 & 19 shown below in the matlab example) and it does not always select the peak that is correct. Is there a way to place additional constraints on the peak it selects? For example, if there is another peak within the following 10 points with approximate equal magnitude select that one instead?
Thanks.
Steph

1 Comment
dpb
on 15 Feb 2017
Edited: dpb
on 16 Feb 2017
Without data to test hypothesis against (and don't have time to take to try to simulate some at the moment), I'd try letting findpeaks find all the peaks as well as those with the constraints you've set and then compare differences in locations to find those within the range you've set. Then you can see if those pairs are within your other magnitude constraint.
Attach the data set (or a subset of it that includes the problematic areas) so folks can try stuff...
ADDENDUM
Or, just check every peak your current search finds for another location around it. If it is known this happens only for these lesser peaks, you could cut down the number to check by selecting only those below some cutoff height value; say 50% of max or the like...
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!