Decimation — decrease sample rate by integer factor

Decimation reduces the original sample rate of a sequence to a lower rate. It is the
opposite of interpolation. `decimate`

lowpass filters the input to
guard against aliasing and downsamples the result. The function uses decimation
algorithms 8.2 and 8.3 from [1].

`decimate`

creates a lowpass filter. The default is a Chebyshev Type I filter designed using`cheby1`

. This filter has a normalized cutoff frequency of`0.8/r`

and a passband ripple of 0.05 dB. Sometimes, the specified filter order produces passband distortion due to round-off errors accumulated from the convolutions needed to create the transfer function.`decimate`

automatically reduces the filter order when distortion causes the magnitude response at the cutoff frequency to differ from the ripple by more than 10^{–6}.When the

`'fir'`

option is chosen,`decimate`

uses`fir1`

to design a lowpass FIR filter with cutoff frequency`1/r`

.When using the FIR filter,

`decimate`

filters the input sequence in only one direction. This conserves memory and is useful for working with long sequences. In the IIR case,`decimate`

applies the filter in the forward and reverse directions using`filtfilt`

to remove phase distortion. In effect, this process doubles the filter order. In both cases, the function minimizes transient effects at both ends of the signal by matching endpoint conditions.Finally,

`decimate`

resamples the data by selecting every`r`

th point from the interior of the filtered signal. In the resampled sequence (`y`

),`y(end)`

matches`x(end)`

when the IIR filter is used, and`y(1)`

matches`x(1)`

when the FIR filter is used.

[1] Digital Signal Processing Committee of the IEEE^{®} Acoustics, Speech, and Signal Processing Society, eds. *Programs
for Digital Signal Processing*. New York: IEEE Press, 1979.