mathematics//signal processing//digital filter//FIR filter

An FIR (finite impulse response) filter is a digital filter whose output is a weighted sum of the last \(M\) input samples and nothing else, and it is chosen when a filter must be guaranteed stable or must delay every frequency by the same amount: in audio and communications, in measurement instruments that must not distort a waveform, and as the decimation stage inside converters. Its weights, the coefficients, are its whole design.


An FIR (finite impulse response) filter is a digital filter whose output is a weighted sum of the last MMM input samples and nothing else, and it is chosen when a filter must be guaranteed stable or must delay every frequency by the same amount: in audio and communications, in measurement instruments that must not distort a waveform, and as the decimation stage inside converters. Its weights, the coefficients, are its whole design.

y[n]=∑m=0M−1w[m] x[n−m]y[n]=\sum_{m=0}^{M-1}w[m]\,x[n-m]y[n]=m=0∑M−1​w[m]x[n−m]

The output y[n]y[n]y[n] is the input xxx seen through the window of coefficients www, slid one sample at a time: a convolution. Fed a single impulse, it answers with its coefficients one after another and then exactly zero, hence the name. The moving average is the simplest case, all weights equal to 1/M1/M1/M.

No feedback means no instability and, with symmetric weights, no phase distortion.

A filter that never reuses its own output cannot run away, whatever its coefficients or their rounding in fixed point. If the weights are symmetric, every frequency is delayed by the same (M−1)/2(M-1)/2(M−1)/2 samples (linear phase), so a pulse keeps its shape and only arrives later.

The price is length, and length is delay. A sharp cut needs many coefficients, from dozens to hundreds, and a symmetric filter of 101 taps run at 1 kHz delays everything by 50 ms, which is acceptable for an analyser and fatal inside a fast loop. An IIR filter achieves the same sharpness with a handful of coefficients, at the cost of phase distortion and possible instability.

The same sliding weighted sum is the layer of a convolutional network. In a CNN the coefficients are learned from data instead of designed, and a network trained on raw vibration often ends up with band-pass filters in its first layer.

Computation grows with length, one multiply and one add per coefficient per sample, which is why long FIR filters live in DSPs and FPGAs with dedicated multiply-accumulate units, or are computed by FFT in blocks (discrete Fourier transform).

Designing one is a matter of specifying the band and the ripple and letting a tool compute the weights (windowed design or equiripple); the filter is fully described by that list of numbers, which makes it easy to certify and to reproduce bit for bit.