seegongsik
SC · Sampling and discrete time

The Sampling Theorem

When you sample a continuous signal at regular intervals, you can recover the original perfectly only if the sampling rate is faster than twice the highest frequency in the signal. If the rate is slower than that, aliasing occurs and a high frequency disguises itself as a low one; in this lesson you move the sampling rate yourself and find that boundary.

Sample fast enough to rebuild the signal

In the upper plot, the gold curve is a sine signal of frequency f0 = 1, and the bright dots are samples taken at regular intervals. The sampling rate starts at fs = 1.4, which is slower than twice the signal frequency (the Nyquist rate, 2), so a red dashed curve of lower frequency, a fake waveform passing through the same dots, is drawn as well. Looking only at the samples you cannot tell the two apart, which means the original signal is lost. The lower plot shows the same situation on the frequency axis: the gold triangle is the original spectrum, the faint triangles are the copies made at every multiple of fs, and the gold dashed lines are the folding frequency ±fs/2. Raise fs above 2 and the red fake and the red overlap shading disappear together.

signal and samples (time)
spectrum and copies (frequency)
sampling rate fs1.40
Sampling rate and recovery
fs = 1.40 · 2 f0 = 2.00 · 1.40 samples/cycle
alias f = 0.40
The sampling rate fs is slower than twice the signal frequency 1, so fewer than two samples land in each cycle. A red fake waveform of lower frequency then passes through the same dots, and from the samples alone you cannot tell it from the original. While fs is between 1 and 2, the fake frequency is fs − 1, so it drops as you lower fs; at fs = 1 it reaches 0 and every sample lands at the same height, 0.
Aliasing (cannot rebuild)

Sample faster than twice

Here is what the sampling theorem states. If every frequency component of a signal lies below fmax (band-limited), then when the sampling rate fs is faster than 2·fmax, those samples alone can recover the original continuous signal without error. This 2·fmax is called the Nyquist rate. The intuition is simple. During each swing you must catch a crest and a trough at least once each, so the samples can follow that oscillation only if you take more than two points per cycle. Sample more sparsely than that and the fast oscillation slips away between one sample and the next.

Observereconstruct ⟸ fs > 2 fmax
You must sample faster than twice fmax to recover the signal.
Chooseat fs = 2 fmax, samples per cycle = ?
At the Nyquist rate there are two samples per cycle.
Fill infs < 2 fmax ⟹ ?
Sampling too slowly causes aliasing.
On your ownalias f = | fmax − ?
The folded fake frequency is |fmax − fs|.

Too slow, and frequencies fold

Sampling copies the signal's spectrum identically at every integer multiple of the sampling rate fs. If the original components run from −fmax to fmax, copies of the same shape line up around ±fs, ±2fs, and so on. When fs is larger than 2·fmax there are gaps between the copies, so you can pick out the original components cleanly; when fs drops below 2·fmax, neighboring copies overlap the original. Components above fs/2 (the folding frequency) then fold back below it, and when fs lies between fmax and 2·fmax, an oscillation at fmax disguises itself as the lower frequency |fmax − fs|. This is aliasing: the red fake on the first screen is exactly this folded frequency, and the red shading in the lower plot marks where the copies overlap.

Reconstruction and the anti-aliasing filter

If you sampled while meeting the Nyquist condition, reconstruction just means spreading each sample into a sinc shape and adding them all up. That is the same as using an ideal low-pass filter with cutoff fs/2 to cut away the copies above fs/2 and keep only the original band. The trouble comes when a real signal is not perfectly band-limited, or noise puts components above fs/2. Sample it as it is and those high components fold back in and contaminate the signal beyond repair. So before sampling you place an anti-aliasing filter that shaves off everything above fs/2 in advance; once aliasing has folded in, it cannot be removed after sampling, so it must always be blocked before sampling.

Back to the first screen

With a slow sampling rate fs, fewer than two samples landed in each cycle and a red fake waveform appeared, passing through the same dots. From the samples alone you could not tell the original from the fake. Raising fs above twice the signal frequency put more than two samples in each cycle, and as the copies on the frequency axis pulled apart, the red fake disappeared too. The band-limited signal passing through the samples was now pinned down to the original alone. Whether the sampling rate exceeded twice the signal's highest frequency decided whether the signal was lost or recovered.

Sampling theorem (Nyquist–Shannon): if a signal is band-limited below fmax, then when the sampling rate fs > 2·fmax, the samples alone recover the original continuous signal perfectly. 2·fmax is the Nyquist rate (two samples per cycle). Sampling copies the spectrum at every fs; if fs < 2·fmax the copies overlap and aliasing appears, and components above fs/2 (the folding frequency) fold back down and disguise themselves as a lower frequency such as |fmax − fs|. Aliasing that has folded in cannot be undone, so before sampling an anti-aliasing filter shaves off everything above fs/2.
On to the next unit

You have seen that when the sampling rate falls short, high frequencies fold in as low ones. The next unit, Aliasing, looks more closely at this folding. Wheels in a video that seem to turn backward, the ripple patterns in digital photos, and sounds whose pitch comes out wrong are all different faces of the same folding. It covers how frequencies bounce back with the folding frequency fs/2 acting as a mirror, and what the anti-aliasing filter does in front of that mirror.