Fourier & the frequency domain · 05 · The analog–digital treaty · 9 min
HardSampling & aliasing
How often must you photograph a wave to capture it completely? The sampling theorem's answer is shockingly clean: more than twice its highest frequency. Honor that, and the dots hold everything. Violate it, and frequencies lie about their identity — aliasing.
Build the intuition
Nyquist: two samples per cycle, minimum
A sinusoid needs at least two samples per cycle to be pinned down — one per half-swing. So sampling at fs captures faithfully only frequencies below fs/2 (the Nyquist frequency). CD audio's 44.1 kHz protects everything to 22 kHz, comfortably past human hearing's ~20 kHz ceiling. The number wasn't a guess.
Aliasing: the impostor frequencies
Sample too slowly and a fast wave threads between your samples, landing exactly where a slower wave would: the two are indistinguishable from the dots alone. The fast frequency masquerades as f − fs (folded into range) — an alias. You've seen it: wagon wheels spinning backward on film, helicopter blades frozen at 24 fps. Cameras sample too.
Prevention, not cure
Once recorded, aliased content is mathematically inseparable from genuine content — the disguise is perfect. So the fix happens before sampling: an analog anti-aliasing filter (a low-pass, last course's tool!) removes everything above fs/2 first. Every microphone input and camera sensor has one. In DSP, hygiene beats heroics.
See it move
Drop the sample rate below twice the signal frequency and watch the orange impostor appear — passing through every dot the true wave produced.
A worked example
The backward wagon wheel, computed
Film at 24 fps records a wheel spoke-pattern repeating 23 times per second.
Sampling 23 Hz at 24 Hz: alias = 23 − 24 = −1 Hz.
Interpretation: a 1 Hz rotation backward — the wheel appears to crawl in reverse, one turn per second, while the stagecoach races forward. A century of moviegoers have watched the sampling theorem fail on purpose.
Out in the world
Moiré on screens and shirts
A striped shirt on camera shimmers with phantom curves: the fabric's fine pattern exceeds the sensor's spatial Nyquist limit and aliases into low-frequency swirls. Camera makers fight it with optical low-pass filters — anti-aliasing, in glass.
Common confusion, cleared
“Sampling at exactly 2× the top frequency is enough.”
The theorem demands strictly more — at exactly 2× you can sample a sine at its zero crossings and record pure silence. Real systems leave margin (44.1 kHz for 20 kHz audio).
“Higher sample rates always mean better quality.”
Beyond covering the signal's bandwidth (plus filter margin), extra rate captures nothing new — the theorem says the lower-rate samples already held everything. It buys data volume, not fidelity.
Recap
- fs > 2fmax: two-plus samples per cycle capture a band-limited signal completely.
- Below that, frequencies fold into impostors — and the disguise is perfect.
- Anti-alias filter before sampling; there is no after.
Progress saves in this browser.