Peak finding and segmentation

4 views (last 30 days)
Adelante
Adelante on 24 Dec 2013
Answered: Image Analyst on 24 Dec 2013
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 Comment
Youssef  Khmou
Youssef Khmou on 24 Dec 2013
Edited: Youssef Khmou on 24 Dec 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?

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 24 Dec 2013
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;

More Answers (0)

Community Treasure Hunt

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

Start Hunting!