Finding largest peaks in a graph

3 次查看(过去 30 天)
A
A 2013-1-28
Hello!
I am writing a little program to plot out the intensities of split spectral lines from a Zeeman experiment.
I get graphs that look like this:
I want to be able to find the major peaks of this plot. I've been using
[pks,locs]=findpeaks(smo);
to find the peaks, but this function finds all of the tiny insignificant peaks. I was thinking of thresholding intensity (i.e. ignoring peaks that are below 5 on the y axis for instance), but I wonder if there is a cleaner way to do this.
Thank you!

回答(1 个)

Image Analyst
Image Analyst 2013-1-28
As explained in the help, set the 'MINPEAKHEIGHT' property to 5:
[peakValues, indexesOfPeaks] = findpeaks(smo, 'MINPEAKHEIGHT', 5);
or if you really want to set smo to zero below some threshold value, such as 7, you can do this first:
smo(smo<7) = 0;
[peakValues, indexesOfPeaks] = findpeaks(smo, 'MINPEAKHEIGHT', 5);
though I don't think that should be necessary with the data you've shown if you use the MinPeakHeight parameter.

标签

Community Treasure Hunt

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

Start Hunting!

Translated by