The stagecoach wheel that spins backward
You have met this lie already, on screen. In an old Western the stagecoach gallops forward, yet its spoked wheels seem to creep slowly backward. The wheel is not bewitched — the camera is sampling, grabbing 24 frames a second, and the spokes turn just a hair more than one spoke-spacing between frames. Your eye, given only the snapshots, picks the simplest story that fits the dots: a slow backward crawl. That gap between what truly happened and the slowest motion that matches the samples is aliasing, and it is exactly what the last guide's Nyquist theorem was warning you about.
Recall the rule from guide 1: to capture a signal faithfully you must sample faster than twice its highest frequency — the Nyquist rate. Aliasing is what happens on the wrong side of that rule. Any component sitting above half the sample rate (the Nyquist frequency, fs/2) does not simply vanish or get ignored. It reappears inside your captured band wearing a disguise — a new, lower frequency that the samples cannot distinguish from a genuine slow signal. The fast tone has not been filtered out; it has been folded in, and it now contaminates your data as a perfect impostor.
The folding rule: where a rogue frequency lands
The disguise follows a precise rule, and it is worth burning into memory. Sampling at rate fs makes the spectrum repeat every fs, so any input frequency f gets mirrored down into the usable band by the formula f_alias = | f - n times fs |, where n is the integer that brings the answer into the range 0 to fs/2. In plain words: take your input frequency, subtract the nearest whole multiple of the sample rate, and the leftover distance is the fake frequency you will actually record.
Put numbers on it. Sample at fs = 1000 Hz, so the Nyquist frequency is 500 Hz and everything from 0 to 500 Hz is captured honestly. Feed in a 600 Hz tone: f_alias = | 600 - 1000 | = 400 Hz, so a real 600 Hz signal shows up in your data as 400 Hz. A 900 Hz tone lands at | 900 - 1000 | = 100 Hz. A 1100 Hz tone also lands at | 1100 - 1000 | = 100 Hz — two different inputs, the same alias. Picture the frequency axis folded like a paper fan along the crease at 500 Hz: 600 folds onto 400, 700 onto 300, and the fold keeps bouncing at every multiple of fs/2. That is why aliasing is also called folding.
This is why aliasing is so insidious in audio and instrumentation: it does not add gentle fuzz, it adds wrong tones that were never in the music. A 21 kHz ultrasonic squeal, sampled at 40 kHz, folds to | 21000 - 40000 | = 19000 Hz — a piercing 19 kHz whine planted right in the audible band. A real-world signal almost always carries energy above Nyquist somewhere (harmonics, hiss, interference), so without a guard those high components do not get politely dropped — they get relocated, in disguise, into the very band you care about.
Why no later filter can ever undo it
Here is the hardest, most important truth of this whole rung, and the reason the title says filter first. Once a fast signal has aliased, the alias is not merely similar to a real low-frequency signal — it is bit-for-bit identical to it. The samples of a 1100 Hz sine taken at 1000 Hz are the exact same numbers as the samples of a 100 Hz sine. There is no clever math, no digital filter, no AI you can run after the converter that recovers the original, because the information that distinguished them was thrown away at the instant of sampling.
fs = 1000 Hz sampling. Two very different sine waves...
k (sample #): 0 1 2 3 4 5
t = k/1000 s: 0.000 0.001 0.002 0.003 0.004 0.005
100 Hz sin(0.2 pi k): 0.000 0.588 0.951 0.951 0.588 0.000
1100 Hz sin(2.2 pi k): 0.000 0.588 0.951 0.951 0.588 0.000
'----------- identical dots -----------'
The 1100 Hz wave wiggles 11x faster, yet lands on the SAME samples.
After sampling, the converter cannot tell which one you fed it.
alias = | f - n*fs | -> | 1100 - 1*1000 | = 100 HzSit with the table for a moment. The 1100 Hz wave swings up and down eleven times faster, but every one of those extra swings happens between two clock ticks, in the dark, where the converter never looks. At each tick it just happens to be passing through the same height as the slow wave. So the recorded dots are the same dots. This is the line to keep forever: sampling below twice the highest frequency causes aliasing that no later filter can undo. The damage is done in the analog world, an instant before the analog-to-digital converter does its job — so the cure must live in the analog world too, before that instant.
The anti-alias filter: a guard at the analog door
The cure is a single, non-negotiable component: an anti-alias filter, which is simply a low-pass filter placed in the analog signal path ahead of the sample-and-hold and converter. Its one job is to make sure that, by the time the signal reaches the sampler, there is essentially nothing left above the Nyquist frequency to fold in. You set its cutoff at the top of the band you care about and lean on its roll-off to crush everything above fs/2 down below the level you can tolerate. It is the bouncer who turns away the fast frequencies before they can sneak inside wearing a slow-frequency costume.
Two details make or break it. First, it must be analog and it must be before the sampler — a filter built in software after the converter is useless against aliasing, because by then the impostor and the real signal are the identical numbers from the last section. Second, it must guard against more than just your wanted signal's stray harmonics. Even if your signal is beautifully band-limited, the wires still pick up wideband noise and interference — a 2 MHz switching regulator nearby, RF hash, thermal hiss — and all of that energy above Nyquist folds straight down into your measurement band. The anti-alias filter is mandatory even when you are sure your signal is clean, precisely because the noise around it is not.
Designing it — and the oversampling escape hatch
Designing the guard is a tug-of-war between the filter's steepness and the sample rate, and the honest centre of it is this: there is no brick-wall filter. A real low-pass cannot drop from full pass to full stop at a single frequency. It rolls off gradually, so you always need a transition band — room between where your signal ends and where the aliasing band begins — for the attenuation to build up. The worst-case fold to watch is the frequency at fs minus your top frequency, because that one lands right back at the top edge of your band.
- Pin down f_max, the highest frequency you actually need, and set the filter cutoff cutoff at or just above it (say 1 kHz for a sensor channel — an RC stage with R = 1.6 k and C = 100 nF gives f = 1/(2 times pi times R times C) ~= 1 kHz).
- Decide how much suppression you need at the alias band. A converter of N bits has a dynamic range of about 6 times N + 1.76 dB, so an alias must be pushed below that to hide under the noise — roughly 74 dB for a 12-bit part.
- Find the gap. With fs = 10 kHz and cutoff 1 kHz, the worst fold sits at fs - f_max = 9 kHz, so the filter has from 1 kHz to 9 kHz (about 3.2 octaves) to reach that 74 dB.
- Pick the order to fit. Each order adds roughly 6 dB/octave; over 3.2 octaves a 2nd-order Sallen-Key gives only about 12 times 3.2 ~= 38 dB — not enough — so you climb to a 4th-order, or you widen the gap by raising fs.
That last clause is the escape hatch, and it is the cleverest idea in modern converters: oversampling. Sample far faster than Nyquist demands and the transition band yawns wide open, so a gentle, cheap filter does the whole job. Push fs from 10 kHz to 1 MHz and a lazy 1st-order RC — a single resistor and capacitor — has decades of room to reach 74 dB. This is exactly the trade a sigma-delta converter makes: it samples at a wild multiple of the signal rate so its anti-alias filter can be almost trivial, then cleans up and slows down in the digital domain afterward. You spend conversion speed to buy back filter simplicity.