Sampling in the frequency domain: spectrum copies
About this lesson
What does sampling do to a spectrum? Take a pulse whose spectrum is a triangle up to B = 3 kHz and sample it with a clock of fs = 8 kHz. Sampling multiplies the signal by a train of impulses, and multiplying in time is convolving in frequency, so the spectrum of the samples is the triangle copied to every multiple of fs. At 8 kHz the copies sit 2 kHz apart and a low-pass filter gets the pulse back exactly. Slow the clock to 4 kHz and the copies overlap and add: that is aliasing, seen in the frequency domain. You will check the copies in Python with numpy. It builds on "Reading a spectrum", "Fourier properties: shift, scale and convolution", "The Nyquist rate" and "Aliasing: the wagon-wheel effect".
A pulse and its spectrum
Our signal is a short smooth pulse, x(t) = 3·sinc²(3t), with t in milliseconds. Its spectrum X(f) is a triangle: it holds every frequency from 0 up to B = 3 kHz and nothing above. Such a signal is called band-limited.
x(t) = B·sinc²(B·t), B = 3 kHz, t in ms
sinc(u) = sin(πu) / (πu)
X(f) = 1 − |f| / B for |f| < 3 kHz
= 0 above
x(0) = 3 (peak); X(0) = 1
band-limited: nothing above B = 3 kHz
(pair: sinc² <-> triangle)Read the lesson step by step
A pulse and its spectrum
Our signal is a short smooth pulse, x(t) = 3·sinc²(3t), with t in milliseconds. Its spectrum X(f) is a triangle: it holds every frequency from 0 up to B = 3 kHz and nothing above. Such a signal is called band-limited.
x(t) = B·sinc²(B·t), B = 3 kHz, t in ms sinc(u) = sin(πu) / (πu) X(f) = 1 − |f| / B for |f| < 3 kHz = 0 above x(0) = 3 (peak); X(0) = 1 band-limited: nothing above B = 3 kHz (pair: sinc² <-> triangle)The clock is a pulse train
The sampling clock makes very short pulses (impulses), one every Ts = 0.125 ms, so fs = 8 kHz. Its spectrum is also a row of thin lines: one at every multiple of fs, at 0, ±8, ±16 kHz and so on.
p(t) = Σ δ(t − n·Ts), Ts = 0.125 ms fs = 1 / Ts = 8 kHz its spectrum is a comb too: P(f) = fs · Σ δ(f − k·fs) lines at k·fs: 0, ±8, ±16 kHz ... (a Dirac comb transforms to a Dirac comb)Sampling is multiplying
The sampler multiplies x(t) by the pulse train. Where a pulse sits, the product keeps the value x(n·Ts). Everywhere else it is zero. What is left is the samples, x[n] = x(n·Ts), as a train of weighted pulses.
xs(t) = x(t) · p(t) = Σ x(n·Ts) · δ(t − n·Ts) n: 0 1 2 3 4 x[n]: 3.00 1.84 0.27 0.04 0.14 (x is even: x[−n] = x[n])Copies slide to every k·fs
Multiplying in time means convolving in frequency. Convolving X(f) with a line at k·fs slides a copy of X(f) to k·fs. So the samples' spectrum is X(f) repeated every 8 kHz: same shape, centred on 0, ±8, ±16 kHz.
x(t)·p(t) <-> X(f) * P(f) (* = convolution) Xs(f) = fs · Σ_k X(f − k·fs) plot: Ts·Xs(f) = Σ_k X(f − k·fs) (each copy height 1) copies centred on 0, ±8, ±16 kHz ...A gap between the copies
Each copy reaches 3 kHz either side of its centre. With fs = 8 kHz the first copy starts at 8 − 3 = 5 kHz, above B = 3 kHz. A 2 kHz gap separates the copies. Nothing overlaps, so nothing is lost.
middle copy −3 .. 3 kHz copy at +fs 5 .. 11 kHz copy at −fs −11 .. −5 kHz gap = fs − 2B = 8 − 6 = 2 kHz no overlap: Ts·Xs(f) = X(f) for |f| < fs/2A low-pass filter rebuilds x(t)
A low-pass filter passes only frequencies below fs/2 = 4 kHz, with gain Ts. It keeps the middle copy and blocks the rest. What comes out is X(f) again, so x(t) comes back exactly, from the samples alone.
ideal low-pass: H(f) = Ts for |f| < fs/2 = 4 kHz = 0 above H(f) · Xs(f) = X(f) in time (Whittaker-Shannon): x(t) = Σ x[n] · sinc((t − n·Ts) / Ts) fs = 8 > 2B = 6 kHz: exactSlow the clock: copies move in
Now slow the clock from 8 down to 4 kHz. Fewer samples per millisecond, and the lines, with their copies, move closer together. At fs = 2B = 6 kHz the copies just touch at 3 kHz. Below that they run into each other.
copy k sits at k·fs fs = 8 kHz gap 2 kHz fs = 6 kHz gap 0 (fs = 2B, touching) fs = 4 kHz gap -2 kHz (overlap) Ts = 1 / fs: 0.125 -> 0.25 msOverlapping copies add
At fs = 4 kHz the copy centred on 4 kHz reaches down to 1 kHz. From 1 to 3 kHz two copies add, and the sum is a flat shelf at 2/3. High frequencies now pose as low ones. This mixing is aliasing.
fs = 4 kHz, copy at +fs: 1 .. 7 kHz for 1 < f < 3 kHz: X(f) + X(f − 4) = (1 − f/3) + (1 − (4 − f)/3) = 2 − 4/3 = 2/3 at f = 2 kHz: true X = 0.33, sum = 0.67The rebuilt pulse is wrong
The filter now passes below fs/2 = 2 kHz. Inside it the shelf is wrong (2/3 where X(f) falls to 1/3), and 2 to 3 kHz is gone. The rebuilt pulse misses x(t), and no filter can undo the overlap.
fs = 4 kHz, cutoff fs/2 = 2 kHz t (ms) true x rebuilt 0 3.00 3.00 (a sample) 0.125 1.84 2.01 0.375 0.04 −0.36 0.5 0.14 0.14 (a sample) 0.625 0.01 0.41 at the samples they agree; between them the rebuilt pulse goes its own wayCheck it in Python
With numpy, compute the spectrum straight from the samples, as a sum over n. At 1, 7 and 9 kHz it prints 0.667 each time: X(1 kHz) = 1 − 1/3, repeated around 8 kHz. The copies are really there.
import numpy as np fs, B = 8.0, 3.0 # kHz n = np.arange(-2000, 2001) x = B*np.sinc(B*n/fs)**2 for f in (1, 7, 9): # kHz e = np.exp(-2j*np.pi*f*n/fs) print(f, round(abs(x@e)/fs, 3)) 1 0.667 7 0.667 9 0.667 np.sinc(u) = sin(πu)/(πu) Ts·Xs(f) = Ts · Σ x[n]·e^(−j2πf·n·Ts) 7 = 8 − 1 and 9 = 8 + 1 kHz: the copy at fs (Python 3 with numpy)The rule: fs > 2B
The copies stay apart when fs > 2B, the Nyquist rate. Then an ideal low-pass at fs/2 rebuilds x(t). If fs is fixed, remove everything above fs/2 before sampling, with an anti-alias filter.
copies apart <=> fs − B > B <=> fs > 2B here: B = 3 kHz -> fs > 6 kHz 8 kHz: apart, exact rebuild 4 kHz: overlap, aliasing real filters are not brick walls, so real systems leave a guard gap (see "Anti-alias filters", "DACs and reconstruction")
5 quick questions
Choose one answer per question. You can change your choices before checking them.
01Sampling a signal x(t) every Ts seconds does what to its spectrum X(f)?
Sampling multiplies x(t) by an impulse train, whose spectrum is a train of lines at k·fs. Multiplying in time is convolving in frequency, so X(f) is copied to every k·fs: Xs(f) = fs·Σ X(f − k·fs).
02A signal holds frequencies up to B = 3 kHz and is sampled at fs = 8 kHz. Where does the copy centred on +fs start and end?
Each copy keeps the full width of X(f), 3 kHz either side of its centre: 8 ± 3 kHz, so 5 to 11 kHz. That leaves a 2 kHz gap above 3 kHz.
03Same signal (B = 3 kHz). At which sampling rate do neighbouring copies just touch?
The copy at fs starts at fs − B. It meets the middle copy's edge at B when fs − B = B, so fs = 2B = 6 kHz. Any slower and they overlap.
04Sampled at fs = 4 kHz, why can no filter rebuild the pulse exactly?
Overlapping copies add up to a flat 2/3 between 1 and 3 kHz. Inside the filter's band (below 2 kHz) the shape is already wrong, and the part from 2 to 3 kHz is missing. Once added, the copies cannot be pulled apart.
05In the Python check (fs = 8 kHz), why does the sum print the same 0.667 at 1, 7 and 9 kHz?
Ts·Xs(f) = Σ X(f − k·fs). At 7 kHz the copy at 8 kHz gives X(−1); at 9 kHz it gives X(1). Both equal 1 − 1/3 = 0.667, the same as X(1) itself.
Glossary
- Spectrum
- How much of each frequency a signal holds; here X(f), drawn against frequency f.
- Band-limited
- A signal whose spectrum is zero above some highest frequency B.
- Impulse train (Dirac comb)
- A row of very short, idealised pulses one period Ts apart. Its spectrum is also a row of lines, one every fs = 1/Ts.
- Convolution
- The operation that multiplying in time becomes in frequency. Convolving a spectrum with a line at k·fs slides a copy of it to k·fs.
- Spectrum copies (images)
- The repeats of X(f) at every multiple of fs in the spectrum of a sampled signal.
- Nyquist rate (2B)
- Twice the highest frequency. Sampling faster than this keeps the copies apart.
- Aliasing
- When copies overlap and add, so high frequencies show up as false lower ones and the signal can no longer be rebuilt.
- Reconstruction (low-pass) filter
- A filter that keeps only frequencies below fs/2, so only the middle copy, and turns the samples back into x(t).
Notes and sources
- The pulse x(t) = 3·sinc²(3t) is chosen because its spectrum is an exact triangle up to 3 kHz; the rates 8 and 4 kHz keep the numbers small (Oppenheim & Willsky, ch. 7). Every curve and value in the figure is computed from this model.
- The spectrum plot shows Ts·Xs(f), the sum of the copies, so every copy keeps height 1; the true Xs(f) is fs times taller. The comb lines stand for impulses and are drawn at height 1.
- The low-pass filter here is ideal (a brick wall). Real filters roll off gradually, which is why real systems sample a good deal faster than 2B.
- A. V. Oppenheim, A. S. Willsky, S. H. Nawab, Signals and Systems, 2nd ed., Pearson, ch. 7 Sampling (impulse-train sampling, reconstruction, aliasing)
- A. V. Oppenheim, R. W. Schafer, J. R. Buck, Discrete-Time Signal Processing, 2nd ed. (course text listed on MIT OCW 6.341 readings)
- MIT OpenCourseWare 6.003 Signals and Systems (D. Freeman, Fall 2011): Fourier representations and sampling
- MIT OpenCourseWare RES.6-007 Signals and Systems (A. V. Oppenheim): sampling for analog and digital systems
- Nyquist–Shannon sampling theorem (Wikipedia): copies of X(f) shifted by multiples of fs and added; distinct when B < fs/2
- Dirac comb (Wikipedia): the Fourier transform of a Dirac comb is a Dirac comb
- Triangular function (Wikipedia): tri(t) and sinc²(f) are a Fourier pair
- Whittaker–Shannon interpolation formula (Wikipedia): equivalent to ideal low-pass filtering of the impulse train
- NumPy documentation: numpy.sinc (the normalized sinc, sin(πx)/(πx))
Quiz Unlocks after the last step.