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 ; the solid one is its bilinear-transform copy at sample rate , designed with prewarping so the corners match.
- Both are 0.707 (−3 dB) at . Toward 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 .
- Raise toward : the difference grows. For corners well below 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?
Near 2.2 kHz. The transform maps analog frequency Ω to digital frequency , which bends high frequencies down toward the Nyquist frequency. rad, which is 2.21 kHz. Prewarping fixes it: design the analog filter for instead of .
Name it
The bilinear transform
Replace every s in an analog H(s) with
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
Low frequencies map almost linearly; near the Nyquist frequency the axis is crushed. So design the analog prototype at prewarped edges, , and those edges land exactly where they should.
A first-order low-pass
With (taking T = 2, which cancels out):
The zero at z = −1 puts a perfect null at .
Butterworth order
To pass to within dB and stop beyond by at least dB, prewarp both edges and use
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
- Prewarp the corner.
- Coefficients.
- The filter.
- Check. Its DC gain is 2(0.2929)/(1 − 0.4142) = 1, its gain at 1 kHz is exactly , and at 4 kHz it's 0.
Answer .
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
- Prewarp both edges. a ratio of 2.414.
- Order.
- Round up. Order 6: three second-order sections, about 15 coefficients.
- 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
- Map the corner.
- In hertz. The filter would cut off 26% lower than designed.
- Prewarp. Prewarping the analog corner to 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 into .
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°.
Step 2
What is ΩT/2?
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?
Impulse invariance samples the analog impulse response, and sampling makes the frequency response periodic: the analog response repeats around multiples of the sample rate and the copies overlap wherever it isn't already near zero at half the sample rate. The bilinear transform doesn't sample anything. It's an algebraic substitution that maps the entire analog frequency axis, from zero to infinity, onto the unit circle exactly once, so no two analog frequencies land on the same digital one and nothing can overlap. The price is the nonlinear squeeze of the frequency axis, which prewarping compensates at the frequencies that matter.
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.