seegongsik
SC · Sampling and discrete time

Aliasing

In sampling, the folding frequency fs/2 acts like a mirror. A true frequency above it does not look any higher; it bounces off the mirror and folds back in as a lower frequency. In this lesson you raise the true frequency and watch the apparent frequency stop climbing and fold back and forth in a zigzag.

Frequencies folding off the mirror

The sampling rate is fixed at fs = 8, and the slider changes the frequency f of the true signal. The upper plot is the time axis. Once f passes the folding frequency fs/2 = 4, a slower fake signal (red dashed) passes through exactly the same samples as the fast true signal (gold), and that fake's frequency is the apparent frequency. At the starting f = 6, the apparent frequency is 2. The lower plot is the folding map: the horizontal axis is the true frequency, the vertical axis the apparent frequency, and the red dot your current position. As you raise f, the apparent frequency climbs to 4, comes back down to 0 at f = 8, and climbs again, repeating in a zigzag. Only in the green-shaded range f < 4 does the apparent frequency equal the true one.

true and impostor (time)
folding map: apparent vs true frequency
true frequency f6.00
Frequency and folding
f = 6.00 · fs = 8.00 · fold fs/2 = 4.00
apparent f_a = 2.00
The true frequency f is above the folding frequency fs/2 = 4. Bouncing off the mirror, the apparent frequency is not f but a lower fake, f_a = |f − fs·round(f/fs)|, and from the samples alone you cannot tell this fake from the true signal. When f is between 4 and 8, the fake sine is drawn with its phase flipped, which is why a wheel can seem to turn backward. Raise f further and the apparent frequency only zigzags between 0 and 4.
Aliased (you see a phantom)

Frequencies fold at the mirror

Taken on their own, the sample points are explained equally well by a sine at the true frequency f and by countless other sines such as fs − f, fs + f, and 2fs − f. The samples cannot tell these apart, and reconstruction picks the lowest of them, the one that falls between 0 and fs/2. So as you raise the true frequency f from 0, the apparent frequency climbs straight up to fs/2, bounces back down with fs/2 as the mirror to reach 0 at fs, and then climbs again, over and over. As a formula, apparent frequency = |f − fs·round(f/fs)|, a triangle wave, and the folding map on the first screen is exactly this triangle wave.

Observefolding (Nyquist) frequency = fs2
The folding frequency is half the sampling rate.
Chooseapparent = true when f ?
If f is below fs/2, what you see is the true frequency.
Fill infs2 < f < fs → apparent = | f − ?
An f between fs/2 and fs folds to |f − fs|.
On your owngeneral fa = | f − fs · ? |
Subtract the integer multiple of fs closest to f to get the fake frequency.

Folding in wheels, photos, and sound

Aliasing shows up with the same face wherever sampling happens. A film camera takes 24 frames per second (fs = 24), so once the spokes of a wheel pass a given spot more than 12 times per second (fs/2), the motion folds and the wheel seems to turn slowly or even backward. A digital camera's sensor samples light at the pixel spacing, so striped clothing or grids finer than that fold into broad ripple patterns (moiré). When audio is sampled at fs, sounds above fs/2 fold in at the wrong pitch and become grating noise. All three are the same phenomenon, happening at the same mirror, fs/2.

The filter guarding the mirror

A fake that has already folded produces exactly the same samples as the true signal, so once sampling is done there is no way to pull the two back apart. It has to be stopped before it folds, which is why a low-pass filter that shaves off everything above fs/2, the anti-aliasing filter, is placed just before sampling. In effect it clears away, in front of the mirror, whatever would be reflected, so the frequencies that would fold in never exist at all. In film, motion blur that smears movement while the shutter is open does this job; in cameras, an optical low-pass filter in front of the sensor; in audio, an analog filter ahead of the ADC. Raising the sampling rate high enough, or, if you cannot, throwing away everything above fs/2 first: those are the two ways to prevent aliasing.

Back to the first screen

On the first screen, the sampling rate was fixed at fs = 8 and only the true frequency f was raised. While f was below the folding frequency 4, the apparent frequency matched the true one, but the moment it passed 4 it bounced off the mirror and the apparent frequency came back down. A slower fake passed through exactly the same samples as the fast true signal, and from the samples alone the two could not be told apart. Raising f further only sent the apparent frequency back and forth between 0 and 4 as a triangle wave. Wheels turning backward, ripples in photos, and sounds losing their pitch all happen at this one mirror. Whether the true frequency passed fs/2 decided whether what you saw was the truth or an illusion.

Aliasing happens with the folding frequency fs/2, half the sampling rate fs, acting as a mirror. A true frequency f above fs/2 folds, on the samples, into a lower fake, the apparent frequency fa = |f − fs·round(f/fs)|, and as f rises, fa becomes a triangle wave going back and forth between 0 and fs/2. If f < fs/2 the result is faithful (what you see is true); above that, it is an illusion. Wheels turning backward, moiré, and pitch distortion in audio are all the same folding. A folded fake cannot be undone after sampling, so it is prevented by shaving off everything above fs/2 with an anti-aliasing (low-pass) filter before sampling.
On to the next unit

Until now you have seen samples only as points in time. Now you need a tool that treats the sequence of those points itself as a single object. The next unit, The z-Transform, is the Laplace transform for discrete signals. It packs a one-step delay into the symbol z⁻¹ and turns discrete signals and difference equations into algebra in z. Just as the s-plane and its poles set the response in continuous time, the z-plane and the poles on it do the same job in discrete time, except that the stability boundary becomes the unit circle instead of the imaginary axis. That difference is the result of sampling wrapping the s-plane onto the z-plane through z = esT.