Code covered by the BSD License

### Highlights fromPeak finding and measurement

4.78947

4.8 | 20 ratings Rate this file 162 Downloads (last 30 days) File Size: 171 KB File ID: #11755

# Peak finding and measurement

20 Jul 2006 (Updated 20 May 2013)

Function to locate and measure the positive peaks and valleys in noisy data sets.

File Information
Description

A fast customizable function for locating and measuring the peaks in noisy time-series signals. Adjustable parameters allow discrimination of "real" signal peaks from noise and background. Determines the position, height, and width of each peak by least-squares curve-fitting. It can find and measure 1000 peaks in a 1,000,000 point signal in 8 seconds. Includes two interactive versions, one with mouse-controlled sliders and one with keyboard control, for adjusting the peak finding criteria in real-time. Self-contained demos show how it works. See http://www.wam.umd.edu/~toh/spectrum/PeakFindingandMeasurement.htm for details.

This version includes new command-line functions findpeaksplot.m, findpeaksnr.m, and peakstats.m. plus version 5.3 of iPeak.

Acknowledgements
MATLAB release MATLAB 7.8 (R2009a)
Tags for This File
Everyone's Tags
Tags I've Applied
22 Mar 2013

Tom, it works very well for me. Thank you!
The start and the end position of the peaks would also help me… the definition of 1% of the peak amplitude would be great.

09 Jan 2013

Dieter, I would be glad to add that if you could define quantitatively what you mean by peak start and end - for example, when the amplitude of the signal reaches 1% of the peak amplitude. Or would some other definition be more appropriate for your work?

08 Jan 2013

It is really good and easy to use. Only one thing I miss: The start and end position of the peaks would be really helpful.

26 Jun 2012

Andre, iPeak reports only the position, height, and width of peak parameterized as Gaussians, not the parabolic results of polyfit. But you can generate the Gaussian model from height.*exp(-((x-position)./(0.6005615.*width)) .^2) and plot it over the raw data. iPeak does this automatically for the peaks detected in the upper window.

26 Jun 2012

This works really well for me, thanks!

One quick question: I would like to overlay the fitted parabola onto the raw data that I used findpeaks on, for visualization purposes (and to show that the fits are reasonable).

I tried going into the function and doing polyval on the coefs that are returned by polyfit, but this doesn't produce anything sensible.

I would like the drawn parabola to have the same units as the original data. Perhaps I could re-create the parabola from the output of findpeaks (ie the width, height, mean, etc), but it seems that polyval and other parabola drawers parameterize the parabolas in other ways.

Any ideas on which way to go??? Thanks!

Andre

03 Jun 2012

Dear MATLAB users, I have x and y as vectors, I plotted them and now I need to detect the peaks and also find the corresponding peak locations. How can I do it?
Mitra

31 Mar 2012

great code for beginner

06 Sep 2011

thanks a lot Tom
this code is so useful

06 Sep 2011

When looking at a signal for the first time, it is best to use iPeak.m, iSignal.m, or ipf.m to inspect the data interactively. All of these can be downloaded from the Matlab File Exchange or from http://terpconnect.umd.edu/~toh/spectrum/SignalProcessingTools.html

Use the "pan and zoom" capabilities of these programs to inspect the whole signal closely. If the signal has important features that cover a very wide amplitude range or are superimposed on a much larger baseline or background, then those features may not be visible when the entire signal is plotted normally. Try using a semilog(x,y) plot, or use iSignal's semilog mode (H key).

05 Sep 2011

i have a .xls file, i saved data of that in a matrix like : r=xlsread(.xls)
now its needed to find peaks but this discrete data (r) is noisy data and using of 'findpeaks' command give me a lot of numbers of peaks (because of nois).
i think your code can help me. so, could you tell me how can i use this?
best regard

03 Sep 2011

I am not exactly sure what you mean by "matrix (discrete) wave" .Please explain.

02 Sep 2011

dear how can i use this for a matrix (discrete) wave?

02 Sep 2011

See http://www.mathworks.com/matlabcentral/fileexchange/23850 for a version that includes iterative curve fitting to selected peak shapes.

04 Jun 2011

See http://www.mathworks.com/matlabcentral/fileexchange/23850-ipeak-interactive-peak-detector-version-1-2 for a version that uses keyboard control and that works in recent versions of Matlab.

12 Feb 2010
05 Jan 2010
19 Aug 2009

And comment out line 372 of rtslid.m as well... :)

19 Aug 2009

Ah, commenting out line 337 of rtslid.m:

"figure(params.fig);"

eliminates crashes for later versions of Matlab...

19 Aug 2009

Very nifty idea but it crashes quickly in Matlab 2008b, 2009a, and 2009b. There are clearly some GUI incompatibilities.

17 Apr 2009

Latest version just uploaded corrects a bug in the FindPeakSlidersG script that caused a malfunction when individual peaks are viewed if the x-axis data series does not start with zero.

21 Jun 2008

Just what I needed! Thank you very much!

29 Apr 2008

fast and reliable tool ... thanks for sharing!

11 Jan 2008

Very useful interactive software! Thanks for sharing this.

20 Nov 2007

Regards,
Dr. Hugo.

06 Nov 2007

This is a good algorithm but can it be changed to give peeks over a certain datum instead of the trough values.

10 Sep 2007

Your algorithm is excellent.But I find a problem in it.
Your algorithm is limited only when the data are positive number.If all the data are negative and there is peak points.Your algorithm can't detect the peak points.
But I can translate the coordinate axis.
It is to make all the y data into positive number. Then using your algorithm we can find the peak points.
I think you can modify your algorithm and make it adapt to the situation that the data is all negative number.
If you can modify your algorithm,please send the message to my email.(lygwxr@yahoo.com.cn)
Thank your.
A student from BIT of China

03 May 2007

You saved my MEng project with this one. I credited you thogh, don't worry.
Many thanks Tom,
Matt.

12 Apr 2007

Perfect for scientific data processing. Good performance without being overly complicated. You just saved me a week of my time.

20 Jan 2007

Would be greate if it will do deconvolution and gave the areas for deconvolved peaks.
In general - great tool!

22 Dec 2006
14 Oct 2006

K. Tampa is correct; extreme.m is the one to use if you want to find ALL the minima and maxima. But "Peak finding and measurement" is intended to distinguish real peaks from noise in experimentally measured signals and to measure their height, position, and width. Two completely different purposes.

03 Oct 2006
15 Sep 2006

Get EXTREME.M in this site and you'll find the ALL peaks (minima and maxima!) of
rand(10^6,1) in less than a second, 10^7 in about 10 sec, and from matrix too, so...

24 Aug 2006

Version 1.2, dated August 24, 2006, is even faster than the previous version It can find and measure 1000 peaks in a 1,000,000 point signal in 13 seconds.

20 Aug 2006

It is pretty good and easy to use. Yet some commercial software,such as origin, can do faster.

24 Jul 2006

replace missing function in ZIP file

02 Aug 2006

Bug fixes

22 Aug 2006

Bug fixes and enhancements (Version 1.1)

25 Aug 2006

Enhancements: Version 1.2 is a faster version of the original findpeaks function.

18 Sep 2006

Change to file details (title, description, requirements, ...),
Enhancements,
Bug fixes.

22 Sep 2006

Change to file details (title, description, requirements, ...)

24 Oct 2006

Change to file details

01 Nov 2006

enhancements

07 Dec 2006

enhancements
Change to file details

17 Apr 2009

Fixes a bug in the FindPeakSlidersG script that caused a malfunction in the individual peak viewing mode when the x-axis data series did not start at zero.

03 Sep 2009

The rtslid.m function in this version has been
modified by commenting out lines 337 and 373
to prevent crashs on Matlab 20078 and 2009,
as recommended by Michael Coen's comment on
http://www.mathworks.com/matlabcentral/fileexchange/11755

12 Sep 2011

Includes the version 3.2 update of iPeak and version 4 of findpeaks.m, as well as the older 2008 version with sliders.

20 Sep 2011

Bug fix

28 Oct 2011

This version includes the findvalleys function and version 3.81 of the interactive iPeak function.

09 May 2012

This zip file includes version 3.9 of the interactive iPeak function.

09 May 2012

Typo correction.

31 Aug 2012

This version includes some additional demos plus version 4 of the interactive iPeak function.

28 Dec 2012

Version 5 has faster jumps between peaks with spacebar and tab keys; other small bug fixes.

20 May 2013

This version includes new command-line functions findpeaksplot.m, findpeaksnr.m, and peakstats.m. plus version 5.3 of iPeak.