C921 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

C9 · Lesson 21 · Sampling and reconstruction

When samples capture a signal exactly, and when they lie

Every digital audio file, oscilloscope trace and phone call depends on a claim that sounds too good to be true: a continuous signal can be recovered exactly from its samples, as long as it's sampled more than twice as fast as its highest frequency. Break that rule and the samples don't just lose detail, they lie: a high frequency masquerades as a low one, and nothing done afterward can tell the difference. That's aliasing, the wagon wheels that turn backward in films. This lesson covers the sampling theorem, what aliasing does, and how a converter turns samples back into a smooth signal.

  • The dashed curve is a cosine at frequency f, and the dots are its samples at rate fs. The solid curve is the lowest-frequency cosine through the same dots: what the samples look like they came from.
  • Below f/fs=0.5 the two curves agree. Above it they part: at 0.9 the samples trace a slow cosine at 0.1 of the sample rate.
  • Press Listen while moving the slider (at fs = 1 kHz): the pitch you hear is the alias, rising to 500 Hz and then falling again as the true frequency keeps rising.

Predict

A 900 Hz tone is sampled at 1 kHz without an anti-aliasing filter. What frequency do the samples show?

Name it

The sampling theorem

Sampling at fs makes copies of the signal's spectrum at every multiple of fs. A signal with no energy above B hertz is captured exactly if

fs>2B

(2B is the Nyquist rate, and fs/2 the Nyquist frequency), because then the copies don't overlap.

Aliasing

A sinusoid at f is indistinguishable after sampling from one at f−kfs for any whole k. Folded into the range 0 to fs/2, it appears at

falias=|f−fsround(f/fs)|

Above fs/2, frequencies fold back down. An anti-aliasing filter before the converter removes them while they can still be told apart (C4 designed one); it needs a guard band between B and fs−B to roll off in.

Reconstruction

Ideally, each sample is replaced by a sinc, sinc((t−nT)/T), and the sincs added: that rebuilds the band-limited signal exactly. A real DAC holds each sample for one period, a zero-order hold, which multiplies the spectrum by

|HZOH(f)|=|sinc(f/fs)|

drooping to 0.637 (−3.9 dB) at fs/2, and leaves images of each tone at fs±f, 2fs±f, …, which a reconstruction filter removes.

Worked example

Sampled at 1 kHz, where do 900 Hz, 1.1 kHz, 600 Hz and 1.6 kHz tones appear?

Show the solution
  1. Fold each tone. |900−1000|=100Hz|1100−1000|=100Hz|600−1000|=400Hz|1600−2000|=400Hz
  2. Compare. Four different tones, two apparent frequencies: once sampled, each pair is identical.

Answer 900 Hz and 1.1 kHz both appear at 100 Hz, and 600 Hz and 1.6 kHz both appear at 400 Hz.

Worked example

CD audio is sampled at 44.1 kHz to carry 20 kHz. What guard band does that leave, and how much does a zero-order hold droop at 20 kHz?

Show the solution
  1. Where the first copy starts. 44.1−20=24.1kHz
  2. Guard band. The anti-aliasing filter has from 20 to 24.1 kHz, a 4.1 kHz guard band, to fall.
  3. Hold droop. sinc⁡(20/44.1)=0.694 or −3.2 dB, which players correct with a gentle boost.

Answer a 4.1 kHz guard band, from 20 to 24.1 kHz, and a droop to 0.694 (−3.2 dB) at 20 kHz.

Worked example

A telephone channel carries 0 to 4 kHz. What sample rate gives the anti-aliasing filter a 1 kHz guard band to fall in?

Show the solution
  1. Where the first copy starts. The first copy of the spectrum after sampling starts at fs−4 kHz.
  2. Leave room to fall. For the filter to have from 4 kHz to that point to fall: fs−4≥4+1fs≥9kHz
  3. What telephony chose. Telephony settled on 8 kHz with a filter that starts rolling off at 3.4 kHz, which gives a guard band of about the same size, 1.2 kHz.

Answer a sample rate of at least 9 kHz.

Check

A 1300 Hz tone is sampled at 1000 Hz with no anti-aliasing filter. At what frequency do the samples show it (between 0 and 1000/2)?

Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.

Check

A signal has no content above 20 kHz. What is its Nyquist rate?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

Check

A DAC with a zero-order hold runs at 22.05 kHz. How much does it droop at 5 kHz, in dB?

Check

A DAC at 8 kHz plays a 1 kHz tone through a zero-order hold.

(a)

Where is the lowest image?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

(b)

Where is the next one up?

Check

A 20 kHz signal is sampled at 44.1 kHz. How wide is the guard band between the signal's edge and the first spectral copy's edge?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

Check

A signal has components up to 20 kHz. Which sample rate captures it without aliasing (with a suitable anti-aliasing filter)?

Check

What is the zero-order hold's gain at 0.45 times the sample rate?

Check

A 1300 Hz tone is sampled at 1000 Hz.

(a)

At what frequency does it appear?

Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.

(b)

What is the highest frequency that can appear?

Check

A zero-order hold reconstructs a signal at 0.25 of the sample rate.

(a)

What is its gain there?

(b)

And in decibels?

Explain why

Why can't aliasing be fixed after the signal has been sampled?

Practice

Keep practicing

11 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.