Aliasing
Folding and the alias formula, the wagon wheel, anti-aliasing filters, oversampling and aliasing in discrete time
On film — wheels that turn backwards
In a western, a stagecoach races across the screen while its wheels slow down, stop, and begin to turn backwards. The camera is not broken. It takes 24 pictures a second, and a spoked wheel that turns through almost exactly one spoke spacing between frames looks, frame after frame, as if it has hardly moved. The same illusion freezes helicopter rotors and aircraft propellers in video (Wagon-wheel effect).
Engineers use it on purpose. An engine's timing is set with a lamp that flashes in step with the crankshaft, and some record turntables carry rings of marks that appear to stand still under mains lighting when the platter turns at exactly rpm (Wagon-wheel effect).
Signal processing calls this aliasing: a frequency the sampler cannot represent, reappearing as one it can.
Sampling at cannot tell a sinusoid at from one at or at , for any whole number . A frequency above the Nyquist frequency is therefore not lost. It reappears below it, as an alias, indistinguishable from a genuine component at that frequency.
Derivation
Why frequencies fold
Sample at , and replace by :
because is a whole number. Replacing by gives , the same samples again, since the cosine is even. Every frequency therefore lands on one in :
Plotted against , the apparent frequency is a zigzag: it rises to , falls back to zero at , and repeats. The frequency axis is folded at the Nyquist frequency like a strip of paper.
📐Twenty-four frames a second
A wheel with 12 identical spokes looks the same after every twelfth of a turn, so its pattern repeats at 12 times its revolutions per second. Film samples it 24 times a second.
- At 2 rev/s the pattern repeats 24 times a second — once per frame — and the wheel appears to stand still.
- At 1.9 rev/s the pattern frequency is 22.8 Hz, which aliases to Hz: the wheel appears to turn backwards at rev/s.
- At 2.1 rev/s it aliases to Hz: forwards, at a crawl.
💡Anti-aliasing filters
After sampling, an alias sits exactly on a frequency the signal might genuinely contain, and no processing can separate the two. Aliasing must be prevented before the sampler, by an analog low-pass filter that removes what the sampler cannot represent.
A real filter needs room to fall from passband to stopband. A component at spoils the wanted band only if it folds into it, which happens from upwards; so the filter must pass and be fully down by . The gap between them is the price of every sampling rate.
📐What oversampling buys
A CD-quality converter must pass 20 kHz within 0.5 dB, and be 96 dB down — the 16-bit noise floor — from kHz, the lowest frequency that folds into the audio band. That gap is about a quarter of an octave, and the filters it demands are brutal: a Butterworth filter of order 65, or an elliptic filter of order 11.
Sample four times faster, at 176.4 kHz, and the stopband starts at kHz: Butterworth order 6, elliptic order 4. The converter then does the sharp filtering in arithmetic and reduces the rate by four (Lesson 5-3) — simple analog parts, precise digital ones.
Aliasing inside the computer. Sequences alias too. Keeping every th sample of a sequence samples it again at , and anything above folds. Before thinning a sequence, low-pass filter it —
scipy.signal.decimate does both in one call. The warning of Lesson 1-1, that throws samples away for good, is this.Things are not always what they seem.
🕰A word from radio
The term grew out of radio engineering, where a superheterodyne receiver lets an unwanted station at an "image" frequency masquerade as the wanted one. Its first written use in signal processing appears to be a 1949 Bell Laboratories memorandum by John Tukey and Richard Hamming; the first published use is Blackman and Tukey's, in 1958 (Aliasing).
⚠Pictures alias too
Images are sampled in space. The shimmering moiré on a striped shirt on television and the jagged steps along a sloping edge are high spatial frequencies folded down. The cure is the same as in time: blur very slightly before the pixels sample, which is why many camera sensors sit behind an optical low-pass filter.
💡Where you will use this
Decimation and resampling (Lesson 5-3) are aliasing control. DFT bins wrap the same way (Lesson 6-2), and digital filter specifications are written on the folded frequency axis (Unit 9). Stroboscopes, timing lights and bandpass sampling (Lesson 5-1) use aliasing on purpose.
📚Further reading
- Oppenheim and Willsky, Signals and Systems, section 7.3 — the effect of undersampling.
- R. B. Blackman and J. W. Tukey, The Measurement of Power Spectra (1958) — the first published use of "aliasing".
- Wagon-wheel effect on Wikipedia.
↓But there is a problem
Suppose the samples were taken properly: fast enough, behind a good filter. The theorem promises that the original can be rebuilt, between the samples as well as at them.
But a digital-to-analog converter does something much cruder: it holds each sample until the next and puts out a staircase. How does a staircase become music — and what did Philips do in 1982, when its converter could not handle the CD's 16-bit samples?