ENع
→Butterworth and Chebyshev
الدرس 43 · Digital filter design

Analog prototypes: Butterworth and Chebyshev

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

18 دقيقة10 خطوات5 أسئلةAdvanced
عن هذا الدرس

Most IIR filters start life as an analog prototype: a classic low-pass with its edge at 1 rad/s. Take one spec (pass up to 1 kHz losing at most 1 dB, block 2 kHz and up by at least 20 dB) and design it twice. Butterworth is as flat as possible, keeps its poles on a circle, and needs order 5. Chebyshev allows 1 dB of ripple, squashes its poles onto an ellipse, and meets the same spec with order 3. Then scale the ladder to real parts and check it with SciPy. It builds on the Circuits lessons on filters and Bode plots and on poles and zeros; the next lesson, the bilinear transform, turns the prototype into a digital filter.

ستتعلّم

حدّد ما تشعر بأنك أتقنته. هذا التقييم الذاتي لا يؤثر في درجة الدرس.

شكل 43 · تفاعلي
01 / 10

The job: a filter 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.

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
جارٍ تحميل الرسم…
أو ← →
اقرأ الدرس خطوة بخطوة
  1. The job: a filter 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.

    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
  2. Order: how many energy stores

    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.

    ideal low-pass: gain 1, then 0 at a sharp edge
      -> its impulse response never ends
         in either direction: not buildable
    
    real filter of order N:
      |H(jΩ)|² = a ratio of polynomials in Ω²
      N capacitors and inductors
      N poles in the s-plane
    
    this ladder: C1, L2, C3  ->  N = 3
  3. Butterworth: as flat as possible

    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.

    |H(jΩ)|² = 1 / (1 + ε²·Ω^(2N))
    
    ε² = 10^(1/10) − 1 = 0.259
      at Ω = 1: |H| = 1/√(1 + ε²) = 0.891  (−1 dB)
    
    maximally flat: the first 2N − 1 derivatives
    of |H|² are zero at Ω = 0
    
    N = 3 ladder values (1 Ω, edge at 1 rad/s):
      C1 = 0.798 F, L2 = 1.597 H, C3 = 0.798 F
    
    meter: generator 2 V peak, load gets |H| volts
  4. Butterworth poles sit on a circle

    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.

    poles on a circle, radius ε^(−1/N) = 1.25
    angles θ = 30°, 90°, 150° from the jΩ axis:
      s = 1.25·(−sin θ + j·cos θ)
    
      s1 = −0.626 + j1.085
      s2 = −1.253
      s3 = −0.626 − j1.085
    
    left half (real part < 0) -> stable
  5. Order 3 misses: Butterworth needs 5

    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.

    loss at Ω = 2:  10·log10(1 + ε²·2^(2N))
      N = 3   12.4 dB   too little
      N = 4   18.3 dB   too little
      N = 5   24.3 dB   meets 20 dB
    
    N ≥ log10((10^(20/10) − 1)/ε²) / (2·log10 2)
      = 4.29  ->  N = 5
    
    >>> sg.buttord(1, 2, 1, 20, analog=True)
    (5, np.float64(1.1446758819614982))
  6. Chebyshev: ripple buys steepness

    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.

    |H(jΩ)|² = 1 / (1 + ε²·T_N(Ω)²)
    T_3(Ω) = 4Ω³ − 3Ω   (T_N(cos θ) = cos Nθ)
    
    |Ω| ≤ 1: −1 ≤ T_3 ≤ 1
      gain between 0.891 and 1 (ripple 1 dB)
    |Ω| > 1: T_3 grows like 4Ω³
      T_3(2) = 26
      loss = 10·log10(1 + ε²·26²) = 22.5 dB
    
    same three parts, new values:
      C1 = 2.024 F, L2 = 0.994 H, C3 = 2.024 F
  7. Chebyshev poles sit on an ellipse

    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.

    a = arsinh(1/ε) / N = 0.476
    s = −sinh(a)·sin θ + j·cosh(a)·cos θ
      sinh a = 0.494  (real semi-axis)
      cosh a = 1.115  (imaginary semi-axis)
    
      s1 = −0.247 + j0.966
      s2 = −0.494
      s3 = −0.247 − j0.966
    
    a pole near the axis at height Ω0
    lifts the gain near Ω0: a ripple peak
  8. Same spec, smaller filter

    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.

    N ≥ arcosh(√((10^(20/10) − 1)/ε²)) / arcosh(2)
      = 2.78  ->  N = 3
    
    >>> sg.cheb1ord(1, 2, 1, 20, analog=True)
    (3, np.float64(1.0))
    
    at 2000 Hz:  Butterworth N=5  24.3 dB
                 Chebyshev   N=3  22.5 dB
    meter at 2000 Hz: 0.0754 V of 2 V in
  9. From prototype to real parts

    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.

    prototype: edge at Ω = 1 rad/s, R = 1 Ω
    target:    edge at 2π·1000 = 6283 rad/s, R = 1 kΩ
    
    C = g / (R·ω)   L = g·R / ω
      C1 = C3 = 2.024 / (1000 × 6283)
              = 322 nF
      L2 = 0.994 × 1000 / 6283
              = 158 mH
    
    the shape of |H| is unchanged:
    only the axis is relabelled in Hz
  10. The prototype in Python

    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.

    from scipy import signal as sg
    >>> z, p, k = sg.cheby1(3, 1, 1, analog=True, output='zpk')
    >>> p
    array([-0.2470853+0.96599867j, -0.4941706-0.j        ,
           -0.2470853-0.96599867j])
    >>> z
    array([], dtype=float64)
    
    no zeros: an all-pole low-pass
    (Python 3, SciPy 1.18, NumPy 2)

اختبار يتاح بعد الخطوة الأخيرة.