Finding largest peaks in a graph

3 Ansichten (letzte 30 Tage)
A
A am 28 Jan. 2013
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!

Antworten (1)

Image Analyst
Image Analyst am 28 Jan. 2013
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.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by