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 of 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', N | Order of interpolation polynomial (default no interpolation)
'plot' | Display the interpolation polynomial overlaid on the point data

## Notes

- To find minima, use PEAK(-V).
- The interp options fits points in the neighbourhood about the peak with an N'th order polynomial and its peak position is returned. Typically choose N to be odd.

## See also

peak2

© 1990-2014 Peter Corke.