Skip to content

Resonators, notches and combs

Put poles where the gain should rise and zeros where it should fall, then design a notch for mains hum, a DC blocker and a comb.

Before this17.1 · 6 more
Chapter 17 · Lesson 4 of 4

First, the picture

A notch removes one frequency and leaves the rest nearly alone: here 50 Hz mains hum in an ECG sampled at 500 Hz. Below, two poles slide toward the two zeros that make the notch. Watch the bracket on the gain curve as they come closer.

Poles behind the zeros narrow the notch

Zeros on the unit circle at ±0.2π (50 Hz at f_s = 500 Hz); poles at the same angle, radius r.

r = 0.8: the notch at 50 Hz is 29.5 Hz wide. A lot of signal around 50 Hz is cut too.

pole radius r
0.80
3 dB width
29.5 Hz
0.00 / 13.00 s
Describe this picture

Two panels for zeros on the unit circle at ±0.2π\pm0.2\pi (50 Hz at fs=500f_s=500 Hz) and poles at the same angle, radius rr. The plane draws the unit circle, the zeros as open circles on it at ±36°, labelled “zeros: 50 Hz”, and the poles as crosses at r∠±36°r\angle\pm36°, labelled “poles”. The gain panel plots the gain ∣H∣\lvert H\rvert against frequency in Hz, with a dashed line at 0.707 labelled “3 dB” and a bracket between its two crossings labelled with the width. The readouts are the pole radius rr and the 3 dB width.

The clip starts at r=0.8r=0.8, where the notch at 50 Hz is 29.5 Hz wide and a lot of signal around 50 Hz is cut too. The poles slide toward the zeros, and the notch narrows. At r=0.9r=0.9 it is 16.0 Hz wide, close to the rule 2(1−r)2(1-r) rad/sample, which is 15.9 Hz here. At the end, r=0.98r=0.98, it is 3.2 Hz wide, and away from 50 Hz each pole’s arrow nearly equals its zero’s, so the gain there is 1. After the clip rr runs from 0.8 to 0.99: the arrow keys step by 0.01, Page Up and Page Down by 0.05, and Home and End jump to 0.8 and 0.99.

Poles behind the zeros narrow the notch

Transfer functions, poles and zeros (16.3) turned the pole-zero picture into a design method: put poles where the gain should rise and zeros where it should fall. Its resonator is the first case. Two poles re±jθre^{\pm j\theta}, close to the unit circle at the wanted angle θ\theta, make a peak near Ω=θ\Omega=\theta. Its width is about 2(1−r)2(1-r) rad/sample, so a pole radius nearer to 1 gives a narrower peak.

The second case is the notch: a filter that removes one frequency and leaves the rest nearly alone. Put zeros on the circle at e±jθe^{\pm j\theta}. At Ω=θ\Omega=\theta the arrow from a zero to the test point has length 0, so the gain is 0 there.

I will use one running example. An ECG is often recorded at fs=500f_s=500 Hz, and mains hum sits at 50 Hz. From Sampling and aliasing (10.1), θ=2πf/fs\theta=2\pi f/f_s, so here θ=2π⋅50/500=0.2π\theta=2\pi\cdot50/500=0.2\pi.

Zeros alone cut a wide band around 50 Hz. Poles just inside the circle at the same angle put the band back: away from θ\theta each pole’s arrow is nearly as long as its zero’s, and they cancel. The result is

H(z)=K 1−2cos⁡θ z−1+z−21−2rcos⁡θ z−1+r2z−2,H(z)=K\,\frac{1-2\cos\theta\,z^{-1}+z^{-2}}{1-2r\cos\theta\,z^{-1}+r^2z^{-2}},

with KK chosen so that the gain is 1 at Ω=0\Omega=0.

The picture at the top of the page draws this filter. When the clip ends, drag either pole along its line, or use the arrow keys, to set rr yourself. Try r=0.95r=0.95: the notch is 8.1 Hz wide.

Here are the numbers behind the picture. Each width is the distance between the two −3-3 dB crossings, found numerically; the rule column is (1−r)fs/π(1-r)f_s/\pi in hertz, which is 2(1−r)2(1-r) rad/sample converted with f=Ωfs/2πf=\Omega f_s/2\pi.

rrKK3 dB width (Hz)rule (Hz)gain at 45 Hz
0.800.904729.4631.830.300
0.900.926216.0015.920.525
0.950.95658.077.960.779
0.980.98103.213.180.953
0.990.99031.601.590.988

The rule is a good guide once rr is close to 1. At r=0.8r=0.8 it is already 8 percent too large, and the gain rises to 1.115 beside the notch, a little above 1. The gain at 50 Hz is exactly 0 for every rr, because the zeros sit on the circle.

To design a notch from a width, invert the rule: r=1−ΔΩ/2r=1-\Delta\Omega/2, where ΔΩ\Delta\Omega is the 3 dB width in rad/sample, the gap between the two frequencies where the gain is 1/21/\sqrt2 times its peak (see How big is a signal, 1.3, for 3 dB). If you have a width Δf\Delta f in hertz, then ΔΩ=2π Δf/fs\Delta\Omega=2\pi\,\Delta f/f_s. For 60 Hz mains, use θ=2π⋅60/fs\theta=2\pi\cdot60/f_s in the same formula.

The gain at Ω=0\Omega=0 is 1 when

K=1−2rcos⁡θ+r22−2cos⁡θ.K=\frac{1-2r\cos\theta+r^2}{2-2\cos\theta}.

This is H(1)=1H(1)=1 solved for KK: put z=1z=1 in the formula above and divide.

A DC blocker is the same idea at Ω=0\Omega=0, where θ=0\theta=0. It has a zero at z=1z=1 and a pole just inside it:

H(z)=1−z−11−0.995z−1.H(z)=\frac{1-z^{-1}}{1-0.995z^{-1}}.

At fs=500f_s=500 Hz its −3-3 dB point is at 0.397 Hz, and the rule (1−0.995)fs/2π(1-0.995)f_s/2\pi gives 0.398 Hz. It removes the slow baseline wander of an ECG: the gain is 0.931 at 1 Hz and 1.002 at 50 Hz.

A delay in a loop grows teeth

A delay in a loop gives a different shape, a whole set of peaks. Take an echo, as in Difference equations (6.1):

y[n]=x[n]+0.8 y[n−D],H(z)=11−0.8z−D.y[n]=x[n]+0.8\,y[n-D],\qquad H(z)=\frac1{1-0.8z^{-D}}.

Each echo is 0.8 of the last, and they are DD samples apart. The poles solve zD=0.8z^D=0.8. That gives DD of them, all at radius 0.81/D0.8^{1/D}, one every 2π/D2\pi/D round the circle. A comb is a filter whose gain has teeth like this: a repeating pattern of peaks along frequency.

Below, the delay grows from 1 sample to 8. Watch the teeth: how many there are, and how tall.

A delay in a loop grows teeth

y[n] = x[n] + 0.8y[n−D] at f_s = 8 kHz: the poles are where z^D = 0.8.

D = 1: one pole at 0.8 and one peak, at 0 Hz: a low-pass, 6.1's loop.

delay D
1 sample (0.125 ms)
teeth every
8000 Hz
0.00 / 14.00 s
Describe this picture

Two panels for y[n]=x[n]+0.8y[n−D]y[n]=x[n]+0.8y[n-D] at fs=8f_s=8 kHz. The plane draws the unit circle and the DD poles, as crosses at radius 0.81/D0.8^{1/D}, where zD=0.8z^D=0.8. The gain panel plots the gain ∣H∣\lvert H\rvert against frequency from 0 to 4000 Hz. The readouts are the delay DD and the spacing of the teeth.

The clip starts at D=1D=1: one pole at 0.8 and one peak, at 0 Hz, a low-pass like 6.1’s loop. At D=2D=2 the two poles sit at 0 and half a turn, with peaks at 0 and 4000 Hz. At D=4D=4 the four poles are a quarter turn apart, with a peak every 2000 Hz. The captions are blank while the poles morph. It ends at D=8D=8, a 1 ms echo: eight poles and a peak every 1000 Hz, each peak 1/(1−0.8)=51/(1-0.8)=5 tall and each dip 1/1.8=0.561/1.8=0.56. After the clip a slider named “Delay D” sets DD from 1 to 16 samples; the arrow keys step by 1, and Home and End jump to 1 and 16.

When the clip ends, set DD yourself with the slider. Try 3: the poles are 120° apart and the peaks 2666.7 Hz apart. Watch which numbers move. The teeth’s height and depth never change; only their spacing does.

The reason is in the formula. A peak is where e−jΩD=1e^{-j\Omega D}=1, so ∣H∣=1/(1−0.8)=5\lvert H\rvert=1/(1-0.8)=5. A dip is where e−jΩD=−1e^{-j\Omega D}=-1, so ∣H∣=1/(1+0.8)=0.556\lvert H\rvert=1/(1+0.8)=0.556. Neither depends on DD. The peaks sit at Ω=2πm/D\Omega=2\pi m/D, which is every fs/Df_s/D in hertz: at fs=8f_s=8 kHz, 8000, 4000, 2000 and 1000 Hz for D=1D=1, 2, 4 and 8.

The impulse response is the echo train: 1 at n=0n=0, 0.8 at n=Dn=D, 0.64 at 2D2D and 0.512 at 3D3D.

Move the delay to the input side and you get the other kind. A feed-forward comb y[n]=x[n]+a x[n−D]y[n]=x[n]+a\,x[n-D] has DD zeros instead of poles, at radius a1/Da^{1/D}, and its gain has notches between the peaks. For a=0.8a=0.8 and D=8D=8 the zeros are at radius 0.9725, and the gain swings between 1.8 and 0.2. Sweep DD slowly from 1 to 10 ms and the notches slide along the frequency axis. This is flanging.

A feed-forward comb also helps with hum. The comb y[n]=x[n]−x[n−10]y[n]=x[n]-x[n-10] at 500 Hz has zeros where z10=1z^{10}=1: at 0, 50, 100, 150, 200 and 250 Hz. It removes the hum and every harmonic, and it also removes the ECG’s own slow part at 0 Hz. In practice you put poles behind its zeros, as in the notch above.

Notch out the mains hum

Mains hum is the 50 or 60 Hz interference that the power supply puts onto a recording, and it is why an ECG needs a notch. Tune the notch of the first instrument onto it and the hum goes, while the heartbeat barely changes. Think of tuning a radio until the whistle drops out. Below, the notch slides from 30 Hz onto the hum; watch the solid trace settle onto the dashed one.

Notch out the mains hum

A synthetic ECG at f_s = 500 Hz with 0.3 mV of 50 Hz hum, through a notch with r = 0.95.

Notch at 30 Hz: it misses. The hum, 0.299 mV, rides on the whole trace.

notch at
30 Hz
hum left
0.299 mV
0.00 / 12.00 s
Describe this picture

A synthetic ECG at fs=500f_s=500 Hz with 0.3 mV of 50 Hz hum, through a notch with r=0.95r=0.95. The trace is synthetic, five Gaussian waves per beat at 72 beats per minute, so every frame can be checked. It shows voltage in mV against time from 1 s to 3 s, with the clean trace as a thin dashed line labelled “ECG without hum” and the notch’s output as a solid line labelled “after the notch”. The first second, where the filter starts from rest, is not drawn. Below it a gain strip marks the hum at 50 Hz with a triangle labelled “hum”. The readouts are where the notch is and how much hum is left.

The clip starts with the notch at 30 Hz: it misses, and the hum, 0.299 mV, rides on the whole trace. The notch slides toward the hum. At 40 Hz, 0.280 mV of hum still gets through. At the end the notch is at 50 Hz: the hum is gone, 0.000 mV, and the trace sits on the clean ECG, with the R peak at 0.99 mV against 1.00 mV. After the clip the notch tunes from 30 to 70 Hz; the arrow keys step by 0.5 Hz and Page Up and Page Down by 5 Hz.

When the clip ends, drag across the gain strip, or use the arrow keys, to tune the notch yourself. At 45 Hz, 0.234 mV of hum is left.

The hum left is the hum’s amplitude, 0.3 mV, times the notch’s gain at 50 Hz, ∣H(ej0.2π)∣\lvert H(e^{j0.2\pi})\rvert. For r=0.95r=0.95 it is 0.299 mV with the notch at 30 Hz, 0.293 at 35, 0.280 at 40, 0.234 at 45 and 0.133 at 48. At 50 Hz it is 0. Past the hum it is 0.233 at 55 Hz, 0.279 at 60 and 0.295 at 70.

The heartbeat’s cost is small. The clean R peak is 0.996 mV. After the 50 Hz notch it is 0.988 mV at r=0.95r=0.95, 0.976 at r=0.9r=0.9 and 0.993 at r=0.98r=0.98. Over 1 to 3 s the output differs from the clean trace by an RMS of 0.0085 mV at 50 Hz, against 0.199 mV when the notch sits at 40 Hz.

Real hum has harmonics, and 150 Hz is common, so use one notch per harmonic, or a comb with poles. In a 60 Hz country, retune to 60 Hz. A notch is IIR, so its phase bends near the hum; Linear-phase systems (17.3) explains why that matters. For an ECG this is accepted because the notch is narrow, and offline you can run the filter forwards and then backwards (filtfilt, covered in a later filtering chapter) to cancel the phase.

The maths behind it · projections

A notch is a soft projection: it removes one direction, the pair of sinusoids at 50 Hz, and leaves the rest nearly untouched. An exact projection onto the complement of the hum’s two-dimensional subspace is a least-squares fit of a 50 Hz sine and cosine, subtracted from the signal. For a steady hum the result is the same.

The maths behind it · seasonal adjustment

Removing a known periodic component before analysing a series is seasonal adjustment. The hum comb 1−z−D1-z^{-D} is the seasonal difference that time-series courses write as ∇D\nabla_D. It removes a pattern that repeats every DD samples, and the mean along with it.

Where you’ll meet this

Biquad equalisers come in Audio equalisers and biquads (20.5), and chains of them in Second-order sections (21.2). Audio effects (29.2) builds echoes, flanging and plucked strings from the combs here. Hum that drifts in frequency needs an adaptive canceller: Adaptive filters: LMS (26.3).

Reference card

QuantityFormulaNotes
Frequency to angleθ=2πf/fs\theta=2\pi f/f_s50 Hz at 500 Hz: 0.2π0.2\pi
Resonatorpoles re±jθre^{\pm j\theta}peak near θ\theta (16.3)
NotchK1−2cos⁡θ z−1+z−21−2rcos⁡θ z−1+r2z−2K\dfrac{1-2\cos\theta\,z^{-1}+z^{-2}}{1-2r\cos\theta\,z^{-1}+r^2z^{-2}}zeros on the circle, poles behind
Width (notch or resonator)ΔΩ≈2(1−r)\Delta\Omega\approx2(1-r) rad/sampleΔf≈(1−r)fs/π\Delta f\approx(1-r)f_s/\pi
Gain 1 at Ω=0\Omega=0K=1−2rcos⁡θ+r22−2cos⁡θK=\dfrac{1-2r\cos\theta+r^2}{2-2\cos\theta}
DC blocker1−z−11−Rz−1\dfrac{1-z^{-1}}{1-Rz^{-1}}, RR just below 1−3-3 dB near (1−R)fs/2π(1-R)f_s/2\pi
Feedback comb11−az−D\dfrac1{1-az^{-D}}DD poles, peaks every fs/Df_s/D, height 1/(1−a)1/(1-a)
Feed-forward comb1+az−D1+az^{-D}DD zeros, notches; flanging if DD sweeps
Hum comb1−z−D1-z^{-D}, D=fs/f0D=f_s/f_0zeros at every multiple of f0f_0, and at 0

End of lesson 17.4

Where to go next.

Phasorium
LibraryEvery lesson, in order

Parts

About Phasorium
Look