vector peak interpolation

An algorithm for finding a maximum or a minimum in a sampled signal.

### Overview

The signal is described with the sequence yi, i = 1...n, where n is the number of samples. Each sample i is associated with an x value (typically, time) given by xi = x1 + (i - 1) dx, where dx is the sample period.

The maximum is looked for in two kinds of locations:

1. At the left and right edge, i.e. at i = 1 and at i = n.
2. At or near all local maxima, i.e. at or near those i that satisfy yi-1 < yiyi+1.

The greatest of the following values, therefore, will be the maximum:

1. y1.
2. The local maxima, which are at or near yi, where yi-1 < yiyi+1.
3. yn.

We will now see what near means. The precision of the result depends on the interpolation method of this algorithm.

### 1. Lowest precision: round to sample

If the interpolation method is None, the local maxima are at the samples m that satisfy ym-1 < ymym+1. Thus, their x values are at xm = x1 + (m - 1) dx, and their y values are ym.

This kind of precision is appropriate for an unordered sequence of values yi: the result is simply the greatest available value.

### 2. Middle precision: parabolic interpolation

If the interpolation method is Parabolic, the algorithm uses one point on each side of every local maximum ym to estimate the location and value of the local maximum. Because a Taylor expansion shows that any smooth curve can be approximated as a parabola in the vicinity of any local maximum, the location xmax and value ymax can be found with the following procedure:

 dy ≡ 1/2 (ym+1 - ym-1)
 d2y ≡ 2 ym - ym-1 - ym+1
 m′ ≡ m + dy/d2y
 xmax = x1 + (m′ - 1) dx
 ymax = ym + 1/2 dy2 / d2y

This kind of precision is appropriate if y is considered a smooth function of x, as in:

Formant: Get minimum...
Formant: Get time of minimum...
Formant: Get maximum...
Formant: Get time of maximum...
Intensity: Get minimum...
Intensity: Get time of minimum...
Intensity: Get maximum...
Intensity: Get time of maximum...

### 3. Higher precision: cubic interpolation

If the interpolation method is Cubic, the interpolation is performed over four points (see vector value interpolation). The results are similar to those of the parabolic interpolation method, but you can use it (or sinc interpolation) if you want the result of a command like Get maximum... to be equal to the result of a sequence of commands like Get time of maximum... and Get value at time....

### 4. Highest precision: sinc interpolation

If the interpolation method is Sinc70 or Sinc700, the algorithm assumes that the signal is a sum of sinc functions, so that a number of points (namely, 70 or 700) on each side of the initial guess m must be taken into account (see vector value interpolation). The algorithm finds the maximum of this continuous function by Brent's method (see Press et al. (1992)).

This method is appropriate for signals that result from sampling a continuous signal after it has been low-pass filtered at the Nyquist frequency. See:

Sound: Get minimum...
Sound: Get time of minimum...
Sound: Get maximum...
Sound: Get time of maximum...
Sound: Get absolute extremum...