C942 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

C9 · Lesson 42 · Designing IIR filters

Borrowing analog designs through the bilinear transform

Decades of analog filter design, Butterworth, Chebyshev and elliptic tables, describe filters by poles and zeros in the s-plane. A digital filter needs them in the z-plane. The bilinear transform carries a whole analog design across in one substitution, keeps it stable, and keeps the shape of its response; its one quirk is that it squeezes the analog frequency axis to fit inside half the sample rate. A sixth-order IIR filter built this way can do the job of an FIR filter several times longer.

  • The dashed curve is an analog first-order low-pass with corner fc; the solid one is its bilinear-transform copy at sample rate fs, designed with prewarping so the corners match.
  • Both are 0.707 (−3 dB) at fc. Toward fs/2 the digital one falls to zero, where the analog one is still well above it: the whole analog axis, up to infinity, has been squeezed into 0 to fs/2.
  • Raise fc toward fs/2: the difference grows. For corners well below fs/2 the two are nearly the same.

Predict

An analog low-pass with its corner at 3 kHz is carried to an 8 kHz digital filter by the bilinear transform with no prewarping. Where does the digital corner end up?

Name it

The bilinear transform

Replace every s in an analog H(s) with

s=2T⋅z−1z+1=2T⋅1−z−11+z−1

It maps the left half of the s-plane inside the unit circle, so a stable analog filter gives a stable digital one, and it maps the whole jΩ axis onto the unit circle once. A filter of order N stays order N.

Frequency warping

On the unit circle, analog and digital frequencies are related by

Ω=2Ttan⁡ω2

Low frequencies map almost linearly; near the Nyquist frequency the axis is crushed. So design the analog prototype at prewarped edges, Ω=2Ttan⁡(πf/fs), and those edges land exactly where they should.

A first-order low-pass

With Ωc=tan⁡(πfc/fs) (taking T = 2, which cancels out):

H(z)=b(1+z−1)1+az−1,b=Ωc1+Ωc,a=Ωc−11+Ωc

The zero at z = −1 puts a perfect null at fs/2.

Butterworth order

To pass to ωp within Ap dB and stop beyond ωs by at least As dB, prewarp both edges and use

N≥log10⁡[(10As/10−1)/(10Ap/10−1)]2log10⁡(Ωs/Ωp)

IIR or FIR

IIR filters reach a given sharpness with far fewer coefficients, but their phase isn't linear, they need care with coefficient precision, and feedback can make them unstable if poles drift outside the unit circle. FIR filters cost more but have exact linear phase and are always stable. Impulse invariance, sampling the analog impulse response, is the other classic method; it keeps the time response but aliases the frequency response, so it suits only low-pass designs well below Nyquist.

Worked example

Design a first-order low-pass with its −3 dB point at 1 kHz for an 8 kHz system.

Show the solution
  1. Prewarp the corner. Ωc=tan⁡(π/8)=0.4142
  2. Coefficients. b=0.4142/1.4142=0.2929a=−0.5858/1.4142=−0.4142
  3. The filter. y[n]=0.4142y[n−1]+0.2929(x[n]+x[n−1])
  4. Check. Its DC gain is 2(0.2929)/(1 − 0.4142) = 1, its gain at 1 kHz is exactly 1/2, and at 4 kHz it's 0.

Answer y[n]=0.4142y[n−1]+0.2929(x[n]+x[n−1]).

Worked example

What Butterworth order meets: within 1 dB to 1 kHz, at least 40 dB down from 2 kHz, at 8 kHz?

Show the solution
  1. Prewarp both edges. Ωp=tan⁡(π/8)=0.4142Ωs=tan⁡(π/4)=1 a ratio of 2.414.
  2. Order. N≥log10⁡(9999/0.2589)2log10⁡2.414=4.587/0.766=5.99
  3. Round up. Order 6: three second-order sections, about 15 coefficients.
  4. Compare an FIR. A Kaiser FIR filter for the same edges and 40 dB needs about 19 taps, and it gets linear phase for the extra cost.

Answer order 6, built as three second-order sections.

Worked example

Without prewarping, where does an analog corner at 3 kHz land in an 8 kHz design?

Show the solution
  1. Map the corner. ω=2arctan⁡(ΩT/2)=2arctan⁡(π×3000/8000)=2arctan⁡(1.178)=1.734rad
  2. In hertz. 1.734×8000/2π=2208Hz The filter would cut off 26% lower than designed.
  3. Prewarp. Prewarping the analog corner to (8000/π)tan⁡(3π/8)=6148Hz puts the digital corner back at exactly 3 kHz.

Answer at 2208 Hz, 26% lower than designed.

Check

A digital filter at 8 kHz should have its corner at 2 kHz.

(a)

At what corner should the analog prototype be designed?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

(b)

How many times higher is that than 2 kHz?

Check

A first-order bilinear low-pass has its corner at 1 kHz, at 8 kHz.

(a)

What is b, the numerator coefficient?

(b)

What is a, the denominator coefficient?

Check

An analog corner of 3 kHz is carried to an 8 kHz design without prewarping.

(a)

Where does the digital corner land?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

(b)

By what percentage is it off?

Check

A Butterworth design needs 40 dB of stopband loss, at most 0.5 dB of passband loss, and the prewarped stopband edge is 3 times the passband edge.

(a)

What does the order formula give, before rounding?

(b)

What order is needed?

Check

Put z=ejω into s=2T⋅1−z−11+z−1.

Step 1

What analog frequency Ω does s = jΩ give? (Its imaginary part.)

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Check

A filter for audio must not change the shape of transients, so every frequency must be delayed equally. Which design fits?

Explain why

Why does the bilinear transform never alias, while impulse invariance does?

Practice

Keep practicing

7 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.