The spec
Our job: a low-pass filter. Tones up to 1 kHz must pass, losing at most 1 dB. Tones from 2 kHz up must be cut by at least 20 dB. The shaded zones on the gain plot are forbidden.
A perfect brick wall (gain 1, then suddenly 0) would need endless parts. A real filter of order N has N energy-storing parts, here capacitors and inductors, and N poles. This ladder has three: C1, L2 and C3.
Butterworth
Butterworth's rule: |H|² = 1/(1 + ε²Ω²ᴺ). Choosing ε² = 0.259 puts exactly 1 dB of loss at 1 kHz. The gain is as flat as possible near zero, never wiggles, and then slides smoothly down.
Where are its poles? The three Butterworth poles sit evenly on a circle of radius 1.25 in the s-plane, 60° apart. All three are in the left half, so the filter is stable: any ringing dies away.
At 2 kHz, order 3 cuts only 12.4 dB; the spec wants 20. Each extra order bends the curve down faster: order 4 gives 18.3 dB, order 5 gives 24.3 dB. Butterworth needs order 5, and buttord agrees.
Chebyshev
Chebyshev swaps Ωᴺ for a Chebyshev polynomial: |H|² = 1/(1 + ε²T₃(Ω)²), T₃ = 4Ω³ − 3Ω. Up to 1 kHz T₃ swings between −1 and 1, so the gain ripples within 1 dB. At 2 kHz T₃ = 26: 22.5 dB.
Chebyshev poles keep the Butterworth angles but sit on an ellipse: real parts are 0.494 times sin θ, imaginary parts 1.115 times cos θ. Poles this close to the jΩ axis give the sharp edge and the ripple peaks.
Same spec, smaller filter: Chebyshev needs order 3 (cheb1ord says 3), Butterworth order 5. That saves two capacitors or inductors. The price is the ripple: tones below 1 kHz get gains that wobble between 0.891 and 1.
Real parts and code
The prototype is designed at 1 rad/s with 1 Ω resistors. For 1 kHz and 1 kΩ, scale every part: C = g/(R·2π·1000), L = g·R/(2π·1000). So 2.024 F becomes 322 nF and 0.994 H becomes 158 mH.
SciPy designs the same prototype: cheby1(3, 1, 1, analog=True, output='zpk') returns the poles −0.247 ± 0.966j and −0.494. Next lesson, the bilinear transform turns this analog prototype into a digital IIR filter.
The working
# step 1/10 · spec spec (a chosen example) passband 0 .. 1000 Hz loss ≤ 1 dB stopband ≥ 2000 Hz loss ≥ 20 dB loss in dB = −20·log10(gain) 1 dB -> gain ≥ 0.891 20 dB -> gain ≤ 0.100 normalised frequency Ω = f / 1000 Hz passband edge Ω = 1, stopband edge Ω = 2
The spec (1 kHz, 1 dB, 2 kHz, 20 dB) and the 1 kΩ resistors are a chosen example. Every gain, pole and part value in the figure is computed from the formulas in this lesson; the test file checks the ladder's response against them. The generator gives 2 V peak. With equal source and load resistors the load can get at most half of it, 1 V, so the meter reads |H| in volts.