FIR and IIR Filters
Digital filters divide into two fundamental types: FIR (Finite Impulse Response) and IIR (Infinite Impulse Response). Both take a sequence of digital samples as input and produce a filtered output sequence, but they differ fundamentally in how they do it, what tradeoffs they offer, and where each is most appropriate. Understanding the difference matters because every digital audio chain, every wireless receiver, and every modem uses one or both types to shape signal bandwidth.
FIR (left) uses only feedforward delay taps — its output depends only on past inputs. IIR (right) feeds the output back into the computation — its output depends on past inputs and past outputs. IIR achieves sharper roll-off with fewer taps but can become unstable.
View LargerFIR Filters
A Finite Impulse Response filter computes each output sample as a weighted sum of a finite number of input samples. There is no feedback: the output depends only on current and past inputs, never on past outputs. The general form is the convolution equation already seen in the DSP Basics lesson:
y[n] = b0x[n] + b1x[n-1] + b2x[n-2] + … + bN-1x[n-(N-1)]
The bk values are the filter coefficients (taps). N is the filter order. Each output sample requires N multiplications and N-1 additions.
FIR filters have three key properties that make them the default choice for most communications and audio DSP work:
- Always stable. Because there is no feedback, FIR filters cannot oscillate or become unstable regardless of coefficient values. This is critical for deployable systems where stability must be guaranteed.
- Linear phase. A symmetric FIR filter introduces a constant time delay to all frequency components of the signal, causing no phase distortion. All frequencies are delayed by exactly the same amount. This is essential for digital data, where the timing and phase of each symbol must be preserved, for pulse and transient measurements, and for high-quality audio crossovers.
- Straightforward design. FIR coefficients are designed by windowing or frequency sampling methods, and the relationship between coefficients and frequency response is direct and transparent.
The disadvantage of FIR filters is computational cost. A sharp low-pass filter may require hundreds to thousands of taps, each requiring a multiply-accumulate operation per output sample. Polyphase filter structures and FFT-based convolution (overlap-add method) reduce this cost significantly, which is how real-time DSP software achieves sharp brick-wall filters in real time on consumer hardware.
IIR Filters
An Infinite Impulse Response filter feeds the output samples back into the computation. The output depends on both current and past inputs and past outputs. The general direct form II structure is:
y[n] = b0x[n] + b1x[n-1] + b2x[n-2] − a1y[n-1] − a2y[n-2]
The bk coefficients are feedforward (input) weights; the ak coefficients are feedback (output) weights. Each second-order section requires only 5 multiplications but the filter can implement a response equivalent to hundreds of FIR taps.
IIR filters are designed by mapping known analog filter prototypes (Butterworth, Chebyshev, Elliptic, Bessel) into the digital domain using the bilinear transform. This gives IIR filters excellent performance with very few coefficients:
- Butterworth IIR: maximally flat magnitude response in the passband, moderate roll-off, smooth phase.
- Chebyshev IIR: equiripple in passband (Type I) or stopband (Type II), steeper roll-off than Butterworth for the same order.
- Elliptic IIR: equiripple in both passband and stopband — the steepest possible roll-off for a given filter order. A 5th-order elliptic IIR can match a 50-tap FIR for roll-off sharpness.
- Bessel IIR: maximally linear phase (among IIR types), used when phase distortion matters more than sharp roll-off.
FIR vs IIR: Head-to-Head Comparison
| Property | FIR | IIR |
|---|---|---|
| Stability | Always stable | Can be unstable; requires careful design |
| Phase response | Linear phase (symmetric coefficients) | Non-linear phase (phase distortion) |
| Computational cost | High (many taps for sharp roll-off) | Low (sharp roll-off with few coefficients) |
| Design method | Windowing, frequency sampling, Parks-McClellan | Bilinear transform from analog prototype |
| Feedback | None (feedforward only) | Yes (output fed back into computation) |
| Best use case | Data links, audio, channel filters | Tone detection, sample rate conversion, notch filters |
Windowing in FIR Design
An ideal brick-wall low-pass filter has an impulse response that is an infinite sinc function — extending from −∞ to +∞ in time. To make it causal and finite, the sinc is truncated to N samples. Simply truncating (rectangular window) causes Gibbs phenomenon: a 9% overshoot at the passband edge and slow roll-off skirts. Applying a window function before truncating reduces the overshoot at the cost of slightly wider transition bandwidth.
Common windows used in FIR design:
- Rectangular: no windowing, sharpest transition, highest sidelobes (−13 dB). Used only when sidelobes are not a concern.
- Hamming: −43 dB sidelobes, moderate roll-off. Good general-purpose window, widely used in channel filters.
- Hann (Hanning): −32 dB sidelobes, slightly wider main lobe than Hamming. Common in audio applications.
- Blackman: −58 dB sidelobes, wider main lobe. Used when high stopband attenuation is required.
- Kaiser: adjustable tradeoff between main lobe width and sidelobe level via a single parameter (β). The most flexible window for DSP filter design.
Poles, Zeros, and Filter Response
Both FIR and IIR filters can be analyzed in the Z-domain (the discrete-time equivalent of the Laplace domain). In the Z-domain, a filter is described by its poles (roots of the denominator polynomial) and zeros (roots of the numerator polynomial).
FIR filters have only zeros (no poles other than at the origin) — which is why they are always stable. IIR filters have poles, and a filter is stable only if all poles lie inside the unit circle in the Z-plane. A pole exactly on the unit circle produces a sustained oscillation; a pole outside the unit circle causes the output to grow exponentially. Visualizing the pole-zero plot of a digital filter immediately shows stability, resonance peaks (poles near the unit circle), and notch frequencies (zeros on the unit circle).
Digital Filters in Practice
FIR filters are chosen when linear phase matters or when very sharp, stable responses are needed: the decimation filters inside every delta-sigma audio ADC, digital loudspeaker crossovers and room correction, channel filters in wireless receivers and modems, and pulse-shaping filters for data transmission.
IIR filters are chosen when computing power is scarce and a small phase shift is acceptable: tone controls and equalizers in audio processors, DC-blocking and smoothing filters for sensor readings in microcontrollers, and digital versions of classic analog responses (Butterworth, Chebyshev) designed with the bilinear transform. A single “biquad” IIR section needs only five multiplications per sample.
Many systems combine both: an IIR filter for a quick, cheap job early in the chain and an FIR filter where waveform shape must be preserved.
Frequently Asked Questions
If digital filters are so good, why do digital systems still have analog filters?
Because a digital filter can only act on signals that have already been digitized. An analog anti-aliasing filter must remove frequencies above half the sample rate before the ADC, or they fold down into the band of interest and can never be separated again. Analog filters also protect the ADC from strong out-of-band signals that would overload it. The usual arrangement is a modest analog filter before the converter and a sharp digital filter after it.
Can a digital filter have a sharper response than an analog crystal filter?
Yes. A 500-tap FIR filter running at 48 kHz sample rate can achieve a shape factor (60 dB BW / 6 dB BW) of 1.05 or better — a near-perfect rectangle. The best crystal filters have shape factors of about 1.3–2.0. However, the digital filter only acts on signals that have already passed through the ADC without clipping. A crystal filter before the ADC prevents clipping; the digital filter provides the selectivity. Modern digital receivers combine both: a wide (3–6 kHz) roofing crystal or SAW filter to protect the ADC, followed by a near-brick-wall digital FIR for final selectivity.
Test Your Knowledge
Answer the questions below to check your understanding of this lesson. Every answer can be found in the lesson above.