Skip to main content

Command Palette

Search for a command to run...

Elliptic Lowpass 2nd Order: Maximum Stopband Attenuation at Minimum Filter Order

Updated
5 min read

Elliptic (Cauer) filters achieve the steepest possible transition from passband to stopband for a given filter order. They pay for this with equiripple in both passband and stopband — but when embedded in a control loop or DSP pipeline, that trade-off is often a clear win. Two biquad multiplies, and you can place a transmission zero exactly where your interference lives.

https://youtu.be/7Lj6FA4efsM

Transfer Function — H(z)

Design parameters: fs = 44 100 Hz, fc = 1 000 Hz, rp = 0.5 dB, rs = 40 dB.

Applying scipy.signal.ellip(2, 0.5, 40, fc, fs=fs) with bilinear transform:

Unnormalized coefficients (scipy output, a₀ = 1.0):

Coefficient Unnormalized Normalized (÷ a₀)
b₀ 0.0156130224 0.0156130224
b₁ −0.0048446366 −0.0048446366
b₂ 0.0156130224 0.0156130224
a₀ 1.0000000000
a₁ −1.7895617657 −1.7895617657
a₂ 0.8175063706 0.8175063706

Since a₀ = 1.0 exactly (scipy.signal.ellip normalizes automatically), the final biquad form is:

$$H(z) = \frac{0.01561 - 0.00484,z^{-1} + 0.01561,z^{-2}}{1 - 1.78956,z^{-1} + 0.81751,z^{-2}}$$

Difference equation:

y[n] = 0.01561·x[n] − 0.00484·x[n−1] + 0.01561·x[n−2]
     + 1.78956·y[n−1] − 0.81751·y[n−2]

The symmetric b coefficients (b₀ = b₂) confirm the transmission zeros sit on the unit circle — a z-domain property unique to elliptic (and Type I FIR) designs. Those zeros fall at ±9 932 Hz, producing >116 dB of attenuation at that frequency.

Frequency Response

Bode plot: magnitude (top) and phase (bottom). fc = 1 kHz marker shown in red.

Quantitative observations:

  • Passband ripple ≤ 0.5 dB up to 1 000 Hz (by design, rp constraint).

  • −3 dB crossover at ≈ 1 381 Hz — above fc because fc defines the rp-dB edge, not the −3 dB point.

  • At 2 kHz: −8.7 dB | at 3 kHz: −16.4 dB | at 5 kHz: −27.2 dB.

  • Transmission zero at 9 932 Hz: >116 dB attenuation — effectively infinite for 16-bit and 24-bit systems.

  • Phase rolls off steeply around the zero; group delay is non-monotonic. Caution for timing-sensitive applications.

Python Implementation

from scipy import signal

B0, B1, B2 =  0.0156130224, -0.0048446366, 0.0156130224
A1, A2      = -1.7895617657,  0.8175063706

def filter_signal(x, fs=44100.0):
    """2nd-order elliptic lowpass, fc=1 kHz, rp=0.5 dB, rs=40 dB."""
    return signal.lfilter([B0, B1, B2], [1.0, A1, A2], x)

To retarget fc, redesign with signal.ellip(2, 0.5, 40, fc, fs=fs) — do not attempt to frequency-scale these coefficients manually.

C Implementation — Direct Form II Transposed

#define B0  ( 0.0156130224f)
#define B1  (-0.0048446366f)
#define B2  ( 0.0156130224f)
#define A1  (-1.7895617657f)
#define A2  ( 0.8175063706f)

typedef struct { float w1, w2; } FilterState;

float filter_process(FilterState *s, float x) {
    float y  = B0*x + s->w1;
    s->w1    = B1*x - A1*y + s->w2;
    s->w2    = B2*x - A2*y;
    return y;
}

Direct Form II Transposed keeps internal state bounded and minimises round-off noise propagation — the right choice for the aggressive coefficient ratios elliptic filters produce. Fixed-point note: a₁ = −1.789 has |a₁| > 1; use Q14 (not Q15) for a-coefficients to avoid overflow.

MATLAB Implementation

fs = 44100; fc = 1000;
[b, a] = ellip(2, 0.5, 40, fc/(fs/2));

figure; freqz(b, a, 2048, fs);   % magnitude + phase
figure; zplane(b, a);             % zeros ON unit circle confirmed

zplane is the fastest sanity check: zeros exactly on the unit circle confirm transmission nulls. Both poles inside the unit circle confirms stability.

Design Trade-offs

Property Elliptic 2nd Order Butterworth 2nd Order
Passband flatness Equiripple (rp = 0.5 dB) Maximally flat
Rolloff at 2×fc −8.7 dB −6.0 dB
Rolloff at 3×fc −16.4 dB −12.0 dB
Transmission zeros Yes (9 932 Hz, >116 dB null) None
Group delay Non-monotonic Monotonic
Coefficient sensitivity Moderate Low

The elliptic filter wins when you need maximum stopband rejection from minimum multiply budget — shutting down a specific harmonic, switching noise spike, or line frequency artifact with just one biquad. It loses when predictable group delay matters: sensor fusion, synchronization loops, or waveform-preserving applications should reach for Bessel or Butterworth instead.

Key Takeaways

  • Steepest rolloff for any filter order: 2nd-order elliptic often beats 4th-order Butterworth in the transition band.

  • Transmission zeros (b₀ = b₂, unit-circle zeros) create theoretically infinite attenuation at specific frequencies.

  • 9 932 Hz null exceeds 116 dB — aim this at a known interference tone (e.g., switching harmonics at ~10 kHz).

  • Use Direct Form II Transposed in C/embedded: minimises state overflow and noise for aggressive a-coefficient values.

  • Fixed-point caution: |a₁| > 1 requires Q14 scaling; validate headroom before deploying on integer DSPs.


Which interference frequency in your system would benefit from an elliptic transmission zero? Drop the Hz value in the comments.

More from this blog

S

SW related to Power electronics

18 posts

SW related to Power electronics