ENع
←Spectrum copies
Lesson 25 · Fourier series and the Fourier transform

Sampling in the frequency domain: spectrum copies

15 min11 steps5 questionsIntermediate
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".

You'll learn to

Tick what you feel confident about. These self-checks do not affect your lesson score.

Fig 25 · Interactive
01 / 11

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)
Loading figure…
or ← →
Read the lesson step by step
  1. 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)
  2. 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)
  3. 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])
  4. 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 ...
  5. 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/2
  6. A 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: exact
  7. Slow 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 ms
  8. Overlapping 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.67
  9. The 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 way
  10. Check 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)
  11. 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")

Quiz Unlocks after the last step.