Design of IIR filters

Designs IIR filters from Butterworth, Chebyshev and elliptic analogue prototypes and maps them to digital form by impulse invariance or the bilinear transformation with pre-warping.

Drafted with Aria, reviewed by the AiCanCode.org team. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

When a microcontroller has to filter several sensor channels in real time, an IIR filter often meets the specification with a fifth of the coefficients an FIR would need. IIR filters are designed by borrowing a proven analogue prototype (Butterworth, Chebyshev, elliptic) and converting it to a digital filter, so you need both the analogue design formulas and the s-to-z mappings.

Key ideas

What makes a filter IIR. The difference equation feeds back past outputs, H(z) = B(z)/A(z) has poles away from the origin, and the impulse response never ends. Sharp transitions are possible at low order, but phase is non-linear and stability (all poles inside the unit circle) must be ensured.

Design route

  1. Convert the digital specification (edges in rad/sample, ripple and attenuation in dB) into an analogue one.
  2. Choose an approximation and order; design the analogue low-pass prototype Ha(s).
  3. Apply a frequency transformation if a high-pass, band-pass or band-stop is needed.
  4. Map Ha(s) to H(z) by impulse invariance or the bilinear transformation.

Analogue approximations

  • Butterworth: maximally flat passband, monotonic response, |H(jΩc)| = 1/√2 (−3 dB) for every order; roll-off 20N dB/decade. Poles lie equally spaced on a circle of radius Ωc in the left half-plane.
  • Chebyshev Type I: equiripple passband, monotonic stopband; steeper transition than Butterworth for the same order.
  • Chebyshev Type II (inverse): flat passband, equiripple stopband.
  • Elliptic (Cauer): ripple in both bands; lowest order for a given specification; the most non-linear phase.
  • Bessel: best approximation to linear phase (nearly constant group delay), but poor selectivity; its property is lost under the bilinear transform.

Impulse invariance. Sample the analogue impulse response: h[n] = T·ha(nT). Each analogue pole s = pk maps to z = e^(pkT), so stability is preserved and the frequency axis is linear (ω = ΩT). But the analogue response is not band-limited, so the digital response is aliased. Usable for low-pass and band-pass filters only, never for high-pass or band-stop.

Bilinear transformation. Substitute s = (2/T)(1 − z⁻¹)/(1 + z⁻¹). The whole jΩ-axis maps once onto the unit circle and the left half-plane onto the interior, so stability is preserved and there is no aliasing. The price is frequency warping, Ω = (2/T) tan(ω/2): the digital band edges must be pre-warped before the analogue design so they land in the right place. Magnitude ripples keep their dB values; only the frequency axis is compressed.

Implementation. High-order IIR filters are realised as cascades of second-order sections (biquads), because a direct high-order form is very sensitive to coefficient quantisation, which can push poles outside the unit circle.

Formulas

  • |Ha(jΩ)|² = 1/(1 + (Ω/Ωc)^(2N)) — Butterworth magnitude squared.
  • N ≥ log10[(10^(0.1As) − 1)/(10^(0.1Ap) − 1)] / (2 log10(Ωs/Ωp)) — Butterworth order (round up).
  • Ωc = Ωp/(10^(0.1Ap) − 1)^(1/2N) — cut-off that meets the passband edge exactly.
  • Ha(s) = 1/(s² + √2 s + 1) — normalised (Ωc = 1 rad/s) 2nd-order Butterworth; replace s by s/Ωc to scale.
  • Attenuation at Ω (dB) = 10 log10(1 + (Ω/Ωc)^(2N)) — Butterworth.
  • 1/(s − pk) → T/(1 − e^(pkT) z⁻¹) — impulse invariance, term by term.
  • s = (2/T)(1 − z⁻¹)/(1 + z⁻¹) — bilinear transformation.
  • Ω = (2/T) tan(ω/2), ω = 2 tan⁻¹(ΩT/2) — bilinear frequency warping.
  • H(z) = K(1 + z⁻¹)/((1 + K) + (K − 1)z⁻¹), K = tan(ωc/2) — first-order Butterworth low-pass by bilinear transform.

Symbols: Ω analogue frequency (rad/s); ω digital frequency (rad/sample); T = 1/fs sampling period (s); Ωp, Ωs passband and stopband edges (rad/s); Ap maximum passband attenuation (dB); As minimum stopband attenuation (dB); N order; Ωc 3 dB cut-off (rad/s); pk analogue poles (s⁻¹).

Worked examples

Example 1 (standard). An analogue Butterworth low-pass must have at most 1 dB attenuation up to 1000 rad/s and at least 40 dB beyond 4000 rad/s. Find the order and the cut-off.

  1. 10^(0.1×40) − 1 = 9999; 10^(0.1×1) − 1 = 0.2589. Ratio = 38 619.
  2. N ≥ log10(38 619)/(2 log10 4) = 4.587/1.204 = 3.81 ⇒ N = 4.
  3. Ωc = 1000/(0.2589)^(1/8) = 1000/0.8446 = 1184 rad/s (meets the passband edge exactly).
  4. Check the stopband: 10 log10(1 + (4000/1184)^8) = 10 log10(1 + 16 970) ≈ 42.3 dB ≥ 40 dB ✓.
  5. N = 4, Ωc ≈ 1184 rad/s.

Example 2 (GATE level). Design a first-order Butterworth digital low-pass with 3 dB cut-off at 1 kHz for fs = 8 kHz, using the bilinear transform. Check the gain at DC, at the cut-off and at fs/2.

  1. Digital cut-off ωc = 2π × 1/8 = π/4 rad/sample.
  2. Pre-warp: Ωc = (2/T) tan(ωc/2) = 16 000 × tan(π/8) = 16 000 × 0.4142 = 6627 rad/s (not 2π × 1000 = 6283 rad/s).
  3. Analogue prototype: Ha(s) = Ωc/(s + Ωc). Substituting the bilinear map gives H(z) = K(1 + z⁻¹)/((1 + K) + (K − 1)z⁻¹) with K = 0.4142.
  4. H(z) = 0.2929(1 + z⁻¹)/(1 − 0.4142z⁻¹); pole at z = 0.4142 (inside — stable), zero at z = −1.
  5. Checks: z = 1: 0.2929 × 2/(1 − 0.4142) = 1; at ω = π/4: |H| = 0.707 (−3 dB) ✓; at z = −1: |H| = 0.
  6. H(z) = 0.2929(1 + z⁻¹)/(1 − 0.4142 z⁻¹).

Common mistakes

  • Skipping pre-warping in a bilinear design — the cut-off lands at the wrong frequency (here about 0.95 kHz instead of 1 kHz).
  • Using impulse invariance for a high-pass or band-stop filter; its aliasing makes this unworkable.
  • Forgetting the factor T in impulse invariance, which scales the gain by fs.
  • Rounding the Butterworth order down. Always round up.
  • Mixing Ap as a ripple fraction with Ap in dB.
  • Claiming IIR filters can have exact linear phase; a causal, stable IIR cannot.
  • Implementing a high-order IIR in one direct form; use cascaded biquads.

For GATE IN

Expect: Butterworth order and cut-off from a specification, magnitude or attenuation at a given frequency, pole locations of a Butterworth prototype, impulse-invariance mapping of a simple pole, bilinear transform of a first-order prototype including pre-warping, and comparisons of Butterworth, Chebyshev and elliptic responses or of impulse invariance and bilinear mapping. Practise the bilinear substitution on 1/(s + a) until it is quick.

Quick check

  1. Gain (dB) of any Butterworth filter at Ωc?
  2. Roll-off of a 3rd-order Butterworth filter?
  3. Which mapping causes aliasing: impulse invariance or bilinear?
  4. Pole s = −2 with T = 0.5 s under impulse invariance maps to?
  5. Which approximation gives the lowest order for a given specification? Answers: 1. −3 dB. 2. 60 dB/decade. 3. Impulse invariance. 4. z = e^(−1) = 0.368. 5. Elliptic.

Try answering each one aloud before you open it.

  1. 1.What is an Infinite Impulse Response (IIR) filter?Concept

    An Infinite Impulse Response (IIR) filter is a type of digital filter that has an impulse response that lasts indefinitely. Unlike Finite Impulse Response (FIR) filters, IIR filters use feedback, which means they have poles in their transfer function. This allows them to achieve a desired frequency response with fewer coefficients compared to FIR filters, making them computationally efficient.

  2. 2.Explain the difference between IIR and FIR filters.Concept

    An IIR filter uses feedback, so its impulse response lasts indefinitely and its transfer function has poles away from the origin; an FIR filter uses only present and past inputs, so its impulse response is finite and all its poles are at z = 0. IIR filters meet a sharp specification with far fewer coefficients and less delay, but their phase is non-linear and stability must be checked. FIR filters are always stable and can be designed with exactly linear phase, at the cost of higher order.

  3. 3.Why are IIR filters preferred in certain applications over FIR filters?Application

    IIR filters are preferred in applications where computational efficiency is crucial because they require fewer coefficients to achieve a desired frequency response. This makes them suitable for real-time applications where processing power is limited. Additionally, IIR filters can provide a sharper cutoff with fewer coefficients compared to FIR filters, which is beneficial in applications like audio processing.

  4. 4.What are the common methods used for designing IIR filters?Concept

    Common methods for designing IIR filters include the Butterworth, Chebyshev Type I and II, and Elliptic filter designs. Each method has its own characteristics: Butterworth filters have a maximally flat frequency response, Chebyshev filters have a steeper roll-off but with ripples in the passband or stopband, and Elliptic filters have the steepest roll-off for a given order but with ripples in both the passband and stopband.

  5. 5.What happens if an IIR filter is not properly designed?Application

    If an IIR filter is not properly designed, it can lead to instability, where the filter output grows without bound. This is because IIR filters have feedback loops, and improper placement of poles can result in poles outside the unit circle in the z-plane, leading to an unstable system. Additionally, poor design can result in an inadequate frequency response, failing to meet the desired specifications.

  6. 6.Explain the significance of poles and zeros in the design of IIR filters.Concept

    Poles and zeros are critical in determining the frequency response of an IIR filter. Poles are associated with the feedback part of the filter and affect the stability and resonance characteristics. Zeros are associated with the feedforward part and help in shaping the frequency response. The placement of poles and zeros in the z-plane determines the filter's behavior, including its stability and frequency selectivity.

  7. 7.How does the bilinear transformation method help in designing IIR filters?Application

    It converts an analogue prototype to a digital filter by substituting s = (2/T)(1 − z⁻¹)/(1 + z⁻¹). The entire jΩ-axis maps once onto the unit circle and the left half-plane maps inside it, so stability is preserved and there is no aliasing. The cost is non-linear frequency warping, Ω = (2/T)tan(ω/2), so the critical digital band edges must be pre-warped before designing the analogue prototype; magnitude levels such as ripple in dB are preserved, but phase linearity is not.

  8. 8.What is the effect of quantization on IIR filter coefficients?Application

    Quantization of IIR filter coefficients can lead to changes in the filter's frequency response and potentially cause instability. This is because quantization introduces errors in the coefficient values, which can shift the poles and zeros in the z-plane. If the poles move outside the unit circle due to quantization, the filter can become unstable.

  9. 9.Design a second-order Butterworth low-pass digital filter with a 1 kHz cut-off at a sampling rate of 8 kHz using the bilinear transformation.Numerical

    The digital cut-off is ωc = 2π(1000/8000) = π/4. Pre-warp: K = tan(ωc/2) = tan(π/8) = 0.4142 (Ωc = 16000 × 0.4142 ≈ 6627 rad/s). Substituting s = (1/K)(1 − z⁻¹)/(1 + z⁻¹) into 1/(s² + √2s + 1) gives H(z) = 0.0976(1 + 2z⁻¹ + z⁻²)/(1 − 0.9428z⁻¹ + 0.3333z⁻²). Checks: H(1) = 1, |H| = 0.707 at ω = π/4, and both zeros are at z = −1.

  10. 10.Design a first-order low-pass IIR filter with a 500 Hz cut-off at a 2 kHz sampling rate using impulse invariance.Numerical

    The analogue prototype is Ha(s) = Ωc/(s + Ωc) with Ωc = 2π × 500 = 3141.6 rad/s, and T = 0.5 ms. Impulse invariance maps the pole s = −Ωc to z = e^(−ΩcT) = e^(−π/2) = 0.208, and with h[n] = T·ha(nT) gives H(z) = ΩcT/(1 − 0.208z⁻¹) = 1.571/(1 − 0.208z⁻¹). Its DC gain is 1.571/0.792 ≈ 1.98, not 1, because the analogue response is not band-limited and aliasing is severe at this low sampling rate; in practice you would normalise the gain or use the bilinear transform.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?