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 SDR processing chain, every digital transceiver, and every digital mode decoder 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 SDR 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 modes (PSK31, FT8) where the phase of the signal carries information — phase distortion corrupts the modulation.
- 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 SDR 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 | Digital modes, audio, SDR 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 SDR 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 Radio
SDR channel filter. The main channel filter in an SDR receiver (the "IF bandwidth" control in SDR# or GQRX) is a FIR filter, typically 128–512 taps long. It selects the desired signal bandwidth and rejects adjacent channels. The FIR's linear phase ensures that digital modes with phase modulation are not distorted. The FFT overlap-add method allows even a 1024-tap FIR to run at 48 kHz on a Raspberry Pi.
DC offset notch. Removing the DC spike in an SDR direct conversion receiver is done with a single-pole IIR high-pass filter (one feedback coefficient). This uses 3 multiplications per sample and is far more efficient than a long FIR for removing a fixed DC component.
Audio tone decoder (Goertzel algorithm). Detecting a CTCSS tone (sub-audible squelch tone) in a received signal uses a Goertzel algorithm — effectively a single-frequency IIR filter tuned exactly to the tone frequency. It requires only 2 multiplications per sample, making it trivially cheap to run continuously on a microcontroller.
Anti-alias and reconstruction filters. The anti-alias filter before the ADC and the reconstruction filter after the DAC are analog filters, not DSP filters — they must operate before and after the digitization boundary. However, in oversampled systems a gentle analog filter is paired with a sharp digital FIR decimation filter inside the ADC chip itself. The delta-sigma ADCs used in high-quality audio use this approach, allowing near-brick-wall digital filtering without the phase distortion of sharp analog filters.
Frequently Asked Questions
Why does the Icom IC-7300 advertise its roofing filter but it also has digital filters?
The roofing filter is an analog bandpass filter placed at the IF before the ADC. Its job is to prevent very strong out-of-band signals from overloading the ADC. Even with digital filters downstream, if a strong signal enters the ADC and saturates it, the ADC clips and produces severe distortion that digital processing cannot recover. The roofing filter protects ADC dynamic range. The subsequent digital filters (FIR) provide the actual selectivity — they can be set to any bandwidth from 50 Hz to 10 kHz — but they rely on the roofing filter having already suppressed out-of-band blockers to below the ADC's full-scale range.
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 SDR transceivers 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. Every answer can be found in the lesson above.