## NAME

extrema -- find the extrema in an array of x and y points

## SYNOPSIS

nextrema = extrema (x, y, curvature, npts, dx) real x[npts], y[npts] # Input data points and output extrema real curvature[npts] # 2nd deriv. of cubic spline at extrema int npts # Number of input data points real dx # Precision of extrema positions

## DESCRIPTION

The input data points are fitted with a cubic interpolation spline. The spline is then searched for points where the first derivative changes sign. The minimum step size of this search is controlled by the parameter dx. The positions of these extrema are returned in the x array, the value of the spline at the extrema are returned in the y array, and the curvature or second derivative of the spline at the extrema are returned in the curvature array. The function returns the number of extrema found.

## SEE ALSO

xtools.peaks