I have a problem with the peaks of a vector. All help will be appreciated.
Consider a vector of 1280 values which has a initial plot diagram below;
i only want to find two highest peak, segment and preserve the related values while tuning the other little peaks into zeroes like in the figure below.
Thank you so much in advance.

1 Kommentar

Youssef  Khmou
Youssef Khmou am 24 Dez. 2013
Bearbeitet: Youssef Khmou am 24 Dez. 2013
did you try some existing peak detection algorithms? this seems like a difficult test, if the result is based on random events, can you use Monte Carlo trials and average them to get a smooth function?

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Image Analyst
Image Analyst am 24 Dez. 2013

0 Stimmen

Try findpeaks() if you have the Signal Processing Toolbox. Otherwise you can use this File Exchange submission: http://www.mathworks.com/matlabcentral/fileexchange/25500-peakfinder
Another way, if your peaks are consistent, is to threshold at 600. Then find the beginning and ending of each peak by calling diff(signal>600) and looking for +1 or -1.
So, which ever way you did it, you now need to find the bottom left and the bottom right of the peak. So scan away from the peak so that you "fall down" the peak until you get to zero. Now you know the complete extent of all peak. You'll have a logical vector of there there is or is not a valid, desired peak. Then you can zero out the non-peak elements:
signal(~validPeakLocations) = 0;

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by