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.
Describe this picture
Two panels for zeros on the unit circle at (50 Hz at Hz) and poles at the same angle, radius . 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 , labelled “poles”. The gain panel plots the gain 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 and the 3 dB width.
The clip starts at , 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 it is 16.0 Hz wide, close to the rule rad/sample, which is 15.9 Hz here. At the end, , 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 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 , close to the unit circle at the wanted angle , make a peak near . Its width is about 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 . At 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 Hz, and mains hum sits at 50 Hz. From Sampling and aliasing (10.1), , so here .
Zeros alone cut a wide band around 50 Hz. Poles just inside the circle at the same angle put the band back: away from each pole’s arrow is nearly as long as its zero’s, and they cancel. The result is
with chosen so that the gain is 1 at .
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 yourself. Try : the notch is 8.1 Hz wide.
Here are the numbers behind the picture. Each width is the distance between the two dB crossings, found numerically; the rule column is in hertz, which is rad/sample converted with .
| 3 dB width (Hz) | rule (Hz) | gain at 45 Hz | ||
|---|---|---|---|---|
| 0.80 | 0.9047 | 29.46 | 31.83 | 0.300 |
| 0.90 | 0.9262 | 16.00 | 15.92 | 0.525 |
| 0.95 | 0.9565 | 8.07 | 7.96 | 0.779 |
| 0.98 | 0.9810 | 3.21 | 3.18 | 0.953 |
| 0.99 | 0.9903 | 1.60 | 1.59 | 0.988 |
The rule is a good guide once is close to 1. At 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 , because the zeros sit on the circle.
To design a notch from a width, invert the rule: , where is the 3 dB width in rad/sample, the gap between the two frequencies where the gain is times its peak (see How big is a signal, 1.3, for 3 dB). If you have a width in hertz, then . For 60 Hz mains, use in the same formula.
The gain at is 1 when
This is solved for : put in the formula above and divide.
A DC blocker is the same idea at , where . It has a zero at and a pole just inside it:
At Hz its dB point is at 0.397 Hz, and the rule 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):
Each echo is 0.8 of the last, and they are samples apart. The poles solve . That gives of them, all at radius , one every 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.
Describe this picture
Two panels for at kHz. The plane draws the unit circle and the poles, as crosses at radius , where . The gain panel plots the gain against frequency from 0 to 4000 Hz. The readouts are the delay and the spacing of the teeth.
The clip starts at : one pole at 0.8 and one peak, at 0 Hz, a low-pass like 6.1’s loop. At the two poles sit at 0 and half a turn, with peaks at 0 and 4000 Hz. At 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 , a 1 ms echo: eight poles and a peak every 1000 Hz, each peak tall and each dip . After the clip a slider named “Delay D” sets 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 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 , so . A dip is where , so . Neither depends on . The peaks sit at , which is every in hertz: at kHz, 8000, 4000, 2000 and 1000 Hz for , 2, 4 and 8.
The impulse response is the echo train: 1 at , 0.8 at , 0.64 at and 0.512 at .
Move the delay to the input side and you get the other kind. A feed-forward comb has zeros instead of poles, at radius , and its gain has notches between the peaks. For and the zeros are at radius 0.9725, and the gain swings between 1.8 and 0.2. Sweep 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 at 500 Hz has zeros where : 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.
Describe this picture
A synthetic ECG at Hz with 0.3 mV of 50 Hz hum, through a notch with . 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, . For 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 , 0.976 at and 0.993 at . 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 is the seasonal difference that time-series courses write as . It removes a pattern that repeats every 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
| Quantity | Formula | Notes |
|---|---|---|
| Frequency to angle | 50 Hz at 500 Hz: | |
| Resonator | poles | peak near (16.3) |
| Notch | zeros on the circle, poles behind | |
| Width (notch or resonator) | rad/sample | |
| Gain 1 at | ||
| DC blocker | , just below 1 | dB near |
| Feedback comb | poles, peaks every , height | |
| Feed-forward comb | zeros, notches; flanging if sweeps | |
| Hum comb | , | zeros at every multiple of , and at 0 |