THE AUDITORY MODELING TOOLBOX

Applies to version: 1.2.0

View the code

Go to function

MAY2011_FINDLOCALPEAKS - finds peaks with optional quadratic interpolation

Input parameters

X is the input signal
M mode ('q' performs quadratic interpolation, 'v' finds valleys instead of peaks)
W is the width tolerance; a peak will be eliminated if there is a higher peak within +-W samples

Output parameters

K are the peak locations in X (fractional if M='q')
V are the peak amplitudes: if M='q' the amplitudes will be interpolated whereas if M~='q' then V=X(K).

Description

Outputs are column vectors regardless of whether X is row or column. If there is a plateau rather than a sharp peak, the routine will place the peak in the centre of the plateau. When the W input argument is specified, the routine will eliminate the lower of any pair of peaks whose separation is <=W; if the peaks have exactly the same height, the second one will be eliminated. All peak locations satisfy 1<K<length(X).

If no output arguments are specified, the results will be plotted.