M-File Help: peak | View code for peak

# peak

Find peaks in vector

yp = peak(y, options) are the values of the maxima in the vector y.

[yp,i] = peak(y, options) as above but also returns the indices of the maxima in the vector y.

[yp,xp] = peak(y, x, options) as above but also returns the corresponding x-coordinates of the maxima in the vector y. x is the same length as y and contains the corresponding x-coordinates.

## Options

'npeaks', N | Number of peaks to return (default all)
'scale', S | Only consider as peaks the largest value in the horizontal range +/- S points.
'interp', M | Order of interpolation polynomial (default no interpolation)
'plot' | Display the interpolation polynomial overlaid on the point data

## Notes

- A maxima is defined as an element that larger than its two neighbours. The first and last element will never be returned as maxima.
- To find minima, use PEAK(-V).
- The interp options fits points in the neighbourhood about the peak with an M'th order polynomial and its peak position is returned. Typically choose M to be odd. In this case XP will be non-integer.

## See also

peak2

© 1990-2014 Peter Corke.