Sampling multiplies a signal by a comb of spikes, and the comb is a sum of cosines. Here the comb is built one cosine at a time, at a sample rate of 10 kHz. Watch each new cosine bring a new pair of copies of the signal’s spectrum.
Copies from the comb's cosines
f_s = 10 kHz. Copy heights are drawn relative to X; each carries a factor 1/T_s.
The comb's first term is a constant, 1. Multiplying by it leaves x alone: one spectrum, centred at 0.
Describe this picture
Two panels; the sample rate is 10 kHz. The comb panel shows “comb so far, in units of 1/T_s” against time in ms: a solid curve, “comb so far”, and, while a cosine is being added, a dashed curve “cosine k = ±1” (or ±2, ±3), drawn in the colour of its copies. The spectrum panel shows size, relative to X’s peak, against frequency in kHz, with triangles centred at , each labelled “k = 0”, “k = ±1” and so on, in the colour of its . Copy heights are drawn relative to , leaving out the factor each carries. The clip runs for 12 s: the cosine for fades in between 2 and 3 s, between 5 and 6 s and between 8 and 9 s. The readout “cosines of the comb added” goes from 0 to 3, while the comb’s peaks go 1, 3, 5, 7 and the copies reach kHz. A caption appears once its picture is complete, so the caption area is empty while a cosine fades in and while the readout is 1.
A sampled signal is a signal times a comb
The page Sampling & aliasing (10.1) found where one tone lands after sampling. This page looks at a whole spectrum at once. The answer is short: sampling puts a copy of the spectrum at every multiple of the sample rate . The sampling theorem is the condition under which those copies do not overlap.
First I need a way to write sampling as an operation on a signal. Take a continuous-time signal and multiply it by the impulse train from Transforms of common signals (8.3), a spike every sample period . A spike times a signal is the spike scaled by the signal’s value there, as in Impulse, step and ramp (3.1). So
The signal is the samples written as spikes. It is a model: the spikes exist on paper, not on a wire. The model is useful because is a continuous-time signal, so the transforms of Chapter 8 apply to it.
The comb has a series, found in Transforms of common signals (8.3): equal arrows of size at every multiple of , for positive and negative multiples alike. Pair the arrow at with the arrow at . Each pair is a cosine, because , as in Complex exponentials & phasors (3.4). So
The signal I use throughout is called . Its spectrum is a triangle from kHz to kHz, with height 1 at . Nothing in is above 4 kHz. I call a signal with that property band-limited, and I call the highest frequency it contains , here kHz. I wrote in hertz, , the form given beside in From series to transform (8.1). A real signal’s spectrum is mirrored at negative frequency, so a real has both edges, kHz.
Each cosine of the comb makes a pair of copies
Multiply by the comb one term at a time. The constant 1 leaves alone, so its spectrum stays where it is. Each cosine term is a modulation, from Properties of the Fourier transform (8.2): in hertz, multiplying by gives half a copy of at and half a copy at ,
The comb’s cosines carry a factor 2, which turns each half copy into a whole one. So makes full copies of at and .
That is what the picture at the top of the page showed, with kHz. Each new cosine in the comb panel brings one new pair of copies in the spectrum panel, in the same colour and label:
- The comb’s first term is a constant, 1. Multiplying by it leaves alone: one spectrum, centred at 0, and a comb flat at 1.
- Two cosines in, the comb’s peaks reach 5 at 0 and at ms, and the copies stand at , and kHz. Each cosine of the comb at makes a pair of copies at .
- With three cosines the comb’s peaks are 7 and the copies reach kHz. Every cosine added sharpens the spikes and adds a pair of copies: sampling copies the spectrum to every multiple of .
The comb with cosines peaks at , in units of , so the peaks are 1, 3, 5 and 7 for . The spikes sharpen because more cosines agree at the peaks and disagree everywhere else. With every cosine added, which is what the comb really has, the copies reach every multiple of .
Adding all the terms, the spectrum of the samples is
Each copy carries the factor . The instruments draw every copy relative to the peak of and leave the factor out. A wallpaper repeats one pattern at every step along the wall: sampling does the same to the spectrum, with as the step.
The maths behind it · systematic sampling
Picking every tenth name from a list, called systematic sampling, has the same trap. If the list repeats a pattern every ten names, every pick lands on the same point of the pattern, and you see only that one point of it. A sampled signal can fail the same way, and the copies are how that failure shows up in the spectrum.
Copies approach, touch, overlap
The copies sit apart. The copy of at 0 reaches up to , and the copy at reaches down to . So between them there is a gap of
A negative value means the copies overlap. For kHz and kHz the space is kHz, and at 9 kHz it is 1 kHz.
The next instrument lowers from 12 kHz to 6 kHz. The dashed box marks what an ideal low-pass from Frequency response and Bode plots (8.4) would keep. Watch the space between the copies close.
Copies approach, touch, overlap
x has nothing above 4 kHz. Copy heights relative to X.
Sample rate 12 kHz: the copies sit with 4 kHz of clear space between them, and the dashed low-pass could lift the middle one out whole.
Describe this picture
One panel, size relative to X’s peak against frequency in kHz, for an with nothing above 4 kHz. The copies for to are drawn faint, labelled “k = 0”, “k = ±1” and so on. A key above the plot names the other marks: the solid curve “spectrum of the samples”, the sum of the copies; the hatched region “overlap”, where copies overlap; and the dashed box from to , “ideal low-pass (8.4)”. The readouts are “sample rate f_s”, in kHz with one decimal, and “space between copies”, which reads “4.0 kHz” at 12 kHz, “touching” at 8 kHz and “overlap of 2.0 kHz” at 6 kHz. The clip runs for 12 s: falls from 12 to 8 kHz in the first six seconds, holds until 7.5 s, then falls to 6 kHz by 10.5 s and holds. Each caption shows only at the rate it describes, 12, 8 or 6 kHz. When the clip ends, the control “Sample rate f_s” turns on: drag across the spectrum, or use the arrow keys (0.1 kHz) and Page Up and Page Down (1 kHz), from 4 to 14 kHz. Below 6 kHz, copies beyond also reach the view, drawn faint and added into the sum but not labelled.
At 12 kHz the copies sit with 4 kHz of clear space between them, and the dashed low-pass could lift the middle one out whole. At 8 kHz, twice the highest frequency, the copies just touch. At 6 kHz they overlap from 2 to 4 kHz. There the heights add to a flat 0.5, and no filter can pull the original back out.
When the clip ends, drag across the spectrum to set the sample rate yourself. The space reaches 0 at 8 kHz, and below that the summed curve loses the triangle’s shape.
Why does the sum read a flat 0.5? At kHz, between 2 and 4 kHz, the triangle is and the copy centred at 6 kHz is . Their sum is . The two slopes cancel, and the original triangle is not recoverable there, because every height in the overlap is the sum of two unknowns.
The fold is an overlap
Page 10.1 said that a tone above half the sample rate folds back. The copies explain why. Take the part of at 3.5 kHz and sample at kHz.
The triangle at kHz has height . The copy centred at 6 kHz carries that point to kHz, and keeps its height . At 2.5 kHz the original triangle has height , so the two add to , the flat value of the overlap. This is 10.1’s fold, kHz, seen as two copies that overlap.
The theorem
If the copies do not overlap, the middle one is a clean copy of and nothing else. An ideal low-pass filter that keeps and has gain lifts it out and cancels the factor . What is left is , and so . That is the whole argument, and it needs the gap to be positive.
Theorem. If for and , the copies do not overlap, and the samples determine : keep the middle copy. Reconstruction (10.3) shows how in time.
This is the Nyquist–Shannon sampling theorem.
Two names go with it, and they are easy to mix up. The number is the Nyquist rate: it belongs to the signal. The number is the Nyquist frequency: it belongs to the sampler. The theorem says the sample rate must exceed the signal’s Nyquist rate. That is the same as saying .
For the example signal, the Nyquist rate is kHz. At 10 kHz the Nyquist frequency is 5 kHz, which is above 4 kHz, so there is room: the space is kHz.
Exactly twice
The theorem says “greater than”, and the instrument showed the copies just touching at 8 kHz. Why not “at least”? Sample a 2 kHz wave at exactly twice its frequency, kHz, so that the samples fall every half period.
The first strip is a sine of size 1 and all its samples are 0, the same as the samples of a signal that is silent. The other two strips are waves of the same frequency and the same size, and they give different dots. No rule can recover the size from the dots, so the theorem asks for strictly more than twice. In the spectrum this is the same event as the copies touching: the spike of the wave at lands on the copy of its mirror spike at .
Real signals need margin
A band-limited signal lasts forever. The reason is the trade of Properties of the Fourier transform (8.2): a signal that is exactly zero above cannot be zero in time outside a finite stretch. The ideal low-pass of Frequency response and Bode plots (8.4) shows the same thing, because its response never stops. A recording lasts a finite time, so it always has a little energy above any you pick.
So practice leaves space and filters first. CD audio keeps content up to 20 kHz, so its Nyquist rate is 40 kHz. It samples at 44.1 kHz, which gives a Nyquist frequency of 22.05 kHz and a space of kHz for a real filter to fall in. Anti-aliasing and practical converters (10.4) picks this up.
The maths behind it · a basis and coordinates
Every signal with nothing above can be written as a weighted sum of the same building blocks, one per sample, with the samples themselves as the weights. Reconstruction (10.3) draws them. A set of building blocks like that is a basis, and the weights are coordinates: when the theorem holds, sampling loses nothing.
Worked example
- Copies. With kHz and kHz, the copies are centred at kHz. The space between them is kHz.
- Slide. The space is 4 kHz at 12 kHz, 1 kHz at 9 kHz and 0 at 8 kHz (touching). At 7 kHz the copies overlap by 1 kHz, and at 6 kHz by 2 kHz. At 6 kHz the triangle and the copy sum to on .
- CD. For kHz the Nyquist rate is 40 kHz. At kHz the Nyquist frequency is kHz and the space is 4.1 kHz.
- Telephone. Speech up to 3.4 kHz has a Nyquist rate of 6.8 kHz. At kHz the space is kHz.
- Comb. The partial sum with cosines peaks at , in units of : 1, 3, 5, 7 for .
- Exactly twice. A 2 kHz sine sampled at 4 kHz gives samples all 0. The cosine gives . The cosine started 45° late gives .
Where you’ll meet this
Every audio interface, phone and sensor board has a sample rate chosen with this rule. The rate has to be more than twice the highest frequency worth keeping, and a filter before the sampler enforces that limit. Page 10.4 is about those filters.
Two ideas continue from here. Reconstruction (10.3) shows what cutting out the middle copy does in time. Bandpass sampling (10.5) asks what happens to a signal whose frequencies sit in a high band, so that its copies can fit in the gaps. Later, The DTFT (12.2) writes the spectrum of the samples as a function of a digital frequency, and the copies reappear as its period.
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| Comb | 8.3’s impulse train | |
| Sampled signal (model) | spikes exist only in the model | |
| Its spectrum | copies every () | |
| Theorem | for and | strictly greater |
| Nyquist rate | of the signal | |
| Nyquist frequency | of the sampler | |
| Space between copies | negative means overlap |