
An algorithm for finding a maximum or a minimum in a sampled signal.
The signal is described with the sequence y_{i}, i = 1...n, where n is the number of samples. Each sample i is associated with an x value (typically, time) given by x_{i} = x_{1} + (i  1) dx, where dx is the sample period.
The maximum is looked for in two kinds of locations:
The greatest of the following values, therefore, will be the maximum:
We will now see what near means. The precision of the result depends on the interpolation method of this algorithm.
If the interpolation method is None, the local maxima are at the samples m that satisfy y_{m1} < y_{m} ≤ y_{m+1}. Thus, their x values are at x_{m} = x_{1} + (m  1) dx, and their y values are y_{m}.
This kind of precision is appropriate for an unordered sequence of values y_{i}: the result is simply the greatest available value.
If the interpolation method is Parabolic, the algorithm uses one point on each side of every local maximum y_{m} 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 x_{max} and value y_{max} can be found with the following procedure:
dy ≡ 1/2 (y_{m+1}  y_{m1}) 
d^{2}y ≡ 2 y_{m}  y_{m1}  y_{m+1} 
m′ ≡ m + dy/d^{2}y 
x_{max} = x_{1} + (m′  1) dx 
y_{max} = y_{m} + 1/2 dy^{2} / d^{2}y 
This kind of precision is appropriate if y is considered a smooth function of x, as in:
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....
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 lowpass filtered at the Nyquist frequency. See:
© ppgb, April 10, 2001