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.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by