|
An algorithm for finding a maximum or a minimum in a sampled signal.
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:
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 ym-1 < ym ≤ ym+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.
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:
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 low-pass filtered at the Nyquist frequency. See:
© ppgb 20200912