Keypress operated interactive peak detector function.
Updated 4 May 2016

View License

iPeak is a keyboard-operated Interactive Peak Finder for time series
data. Expected input forms:
ipeak(y); % Data in single y vector')
ipeak(x,y); % Data in separate x and y vectors')
ipeak(DataMatrix); % Data in two columns of DataMatrix')
ipeak(x,y,10), ipeak([x;y],10) or ipeak(y,10), specifying peak density, PeakD
ipeak(DataMatrix,PeakD,AmpT,SlopeT,SmoothW,FitW) specifying peak density, AmpT, SlopeT, SmoothW, FitW')
ipeak(DataMatrix,PeakD,AmpT,SlopeT,SmoothW,FitW,xcenter,xrange) Adding pan and zoom settings ')
ipeak(DataMatrix,PeakD,AmpT,SlopeT,SmoothW,FitW,xcenter,xrange,Autozero) Adding Autozeo as 9th argument')
ipeak(DataMatrix,PeakD,AmpT,SlopeT,SmoothW,FitW,xcenter,xrange,MaxError,positions,names) Adding peak ID')

EXAMPLE 1: One input argument; data in single vector
>> y=cos(.1:.1:100);ipeak(y)

EXAMPLE 2: One input argument; data in two columns of a matrix
>> x=[0:.01:5]';y=x.*sin(x.^2).^2;M=[x y];ipeak(M);

EXAMPLE 3: Two input arguments; data in separate x and y vectors
>> x=[0:.1:100];y=(x.*sin(x)).^2;ipeak(x,y);

EXAMPLE 4: Additional input argument (after the data) to control peak
>> x=[0:.1:100];y=5+5.*cos(x)+randn(size(x));ipeak(x,y,10);
or >> ipeak([x;y],10); or >> ipeak(humps(0:.01:2),3)
or >> x=[0:.1:10];y=exp(-(x-5).^2);ipeak([x' y'],1)
T. C. O'Haver (toh@umd.edu),

Cite As

Tom O'Haver (2024). iPeak (https://www.mathworks.com/matlabcentral/fileexchange/23850-ipeak), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!


Version Published Release Notes

Fixed bug in halfwidth measurements of flat-top shape mode.

Version 7.5 April, 2016, Added Flat top peak shape (ShapeMode=2). Fixed bug in fitting error calculations.

Bug fix

Improved performance for detecting narrow spikes in the flat-top mode (shapemode 2)

Version 7.3 October, 2015, relocates peak numbers above peaks on upper and lower graphs; Reports FWHM for Voigt shapes (shape numbers 20 and 30).

Version 7.1 adds improved Octave compatibility and includes 33 model peak shapes for curve fitting.

Version 6 adds an ensemble averaging function (Shift-E).

Version 5.96 adds interpolation function (Shift-I).

Version 5.9 adds relative % fitting error as 6th column of peak table

Version 5.8: Includes version 4.2 of peakfit.m, adds Voigt profile shape and flat baseline mode for iterative least-squares fits.

Version 5.3 adds table of summary statistics of the maximum, minimum, average, percent standard deviation, and displays histograms of the peak intervals (the x-axis interval between adjacent detected peaks), heights, widths, and areas.

Version 5: Faster jump between peaks with spacebar and tab keys; other small bug fixes

Version 4.1: peakfit internal function updated to version 3.3. Bug fixes.

Version 4.0, August, 2012, adds 'H' key to help in detecting 'shoulders' and poorly-resolved peaks.

Typo correction.

Version 3.9: Bug fixes; replaced internal findpeaks function with version 4; FitWidth now equals number of points, not number of intervals.

Version 3.9: Bug fixes; replaced internal findpeaks function with version 4; FitWidth now equals number of points, not number of intervals.

Version 3.8 adds manual entry of AmpT after entering number of click points for background subtraction; '0' key to set minimum to zero.

Version 3.7, Adds valley detection mode (U key)

Bug fixes

Version 3.2 has better noise
discrimination, adds log y (Y key), autozero mode (T key), jump to next/previous peak (Space/Tab keys).

Version 3 adds iterative least-squares curve fitting with selected peak shapes.

Edited description

Version 2 allows specifying the initial values of pan and zoom. Also the 'IDpeak' function compares the found peak positions (maximum x-values) to a database of known peaks and identifies matching peaks in the signal.

Improved keyboard error handling

Includes embedded functions that were omitted in previous version.

Several enhancements to UI and input argument flexibility. Added baseline restore function.

Improved graphics performance on Matlab 7.8 (R2009a)

Version 1.1 adds "L" keypress to toggle peak labels in upper panel ON and OFF. Peak shown in the upper panel (zoom-in view) are labeled with peak position, height, and width, which changes in real-time as the peak detection parameters are varied.

Revised description