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

S7 · Lesson 4 · Sampling and reconstruction in depth

The sampled spectrum, aliasing and folding, ideal and zero-order-hold reconstruction, discrete-time processing of continuous-time signals, quantization and the case for oversampling

Every digital system that touches the physical world sits between an analog-to-digital converter and a digital-to-analog one, and the theory that connects them is short and exact. Sampling at rate fs copies the signal's spectrum at every multiple of fs; if the copies overlap, information is destroyed for good. Reconstruction removes the copies again, but real converters hold each sample as a staircase, which tilts the spectrum and leaves images behind. This lesson works through all of it with real numbers, ending with the reason modern audio converters sample far faster than the Nyquist rate requires.

  • The apparent frequency of a tone after sampling at fs, against the tone's true frequency: fa=|f−fsround(f/fs)|.
  • Below fs/2 the tone comes through unchanged. Above it the frequency folds back, a zigzag between 0 and fs/2.
  • At 44.1 kHz a 30 kHz tone appears at 14.1 kHz and a 25 kHz tone at 19.1 kHz, both inside the audio band, which is why the anti-aliasing filter must come before the converter.

Predict

A CD player's converter holds each sample for one period (a zero-order hold). How much does that alone attenuate a 20 kHz tone at 44.1 kHz?

Name it

The sampled spectrum

Sampling xc(t) every T seconds gives x[n]=xc(nT) with

X(ejω)=1T∑k=−∞∞Xc(j(ωT−2πkT))

copies of the analog spectrum every Ωs=2π/T, with ω = ΩT. If xc is bandlimited to ΩN and Ωs>2ΩN (the Nyquist rate), the copies don't overlap and xc can be recovered exactly; otherwise they alias: a tone at f appears at |f−fsround(f/fs)|.

Reconstruction

  • Ideal: lowpass the impulse train at π/T, which interpolates with sincs: xc(t)=∑nx[n]sin⁡(π(t−nT)/T)π(t−nT)/T.
  • Zero-order hold: holding each value for T multiplies the spectrum by sin⁡(ΩT/2)ΩT/2e−jΩT/2: a droop of 3.92 dB at fs/2, half a sample of delay, and images at multiples of fs that a smoothing filter must remove.

Discrete-time processing of continuous-time signals

C/D conversion, a discrete-time system H(ejω), then ideal D/C behaves like an analog filter

Heff(jΩ)=H(ejΩT),|Ω|<π/T

so a digital cutoff ωc means an analog cutoff ωcfs/2π Hz.

Quantization

A B-bit quantizer driven by a full-scale sine has SNR ≈ 6.02B + 1.76 dB, with its noise spread evenly from 0 to fs/2. Oversampling by a factor M spreads the same noise over M times the bandwidth, gaining 10 log M dB in band, and relaxes the anti-aliasing filter.

Worked example

A 48 kHz audio converter must pass 20 kHz and reject anything that would alias into it by 60 dB. How steep must a Butterworth anti-aliasing filter be?

Show the solution
  1. What aliases into the band. Signals above 28 kHz alias into 0 to 20 kHz (48 − 28 = 20), so the filter needs 60 dB at 28 kHz with its corner at 20 kHz.
  2. Butterworth order. N≥log⁡(106−1)2log⁡(1.4)=20.5 so it takes a 21st-order analog filter.
  3. Oversample instead. Oversampling by 64 moves the first aliasing band to f=(64×48−20)kHz=3.05MHz where a simple second-order filter is plenty; the digital decimation filter then does the sharp cutting.

Answer a 21st-order Butterworth filter (N ≥ 20.5); oversampling by 64 lets a second-order filter do the job.

Worked example

A 30 kHz tone and a 25 kHz tone are sampled at 44.1 kHz without filtering. Where do they appear, and what does a zero-order hold do to a 20 kHz tone?

Show the solution
  1. The 30 kHz tone. f=|30−44.1|kHz=14.1kHz
  2. The 25 kHz tone. f=|25−44.1|kHz=19.1kHz
  3. Hold droop at 20 kHz. On playback through a zero-order hold, with 20/44.1 = 0.4535: G=20log⁡sin⁡(0.4535π)0.4535π=−3.17dB
  4. Image. An image appears at 44.1 − 20 = 24.1 kHz for the smoothing filter to remove.

Answer the tones appear at 14.1 kHz and 19.1 kHz; the hold leaves 20 kHz down 3.17 dB, with an image at 24.1 kHz.

Worked example

A zero-order-hold DAC is used up to 0.4fs. How much does it droop there, and what must a compensating digital filter do?

Show the solution
  1. Hold response at 0.4fs. H=sin⁡(πf/fs)πf/fs=sin⁡(0.4π)0.4π=0.757 That's a droop of 2.42 dB.
  2. Compensation. A short FIR "inverse-sinc" filter before the DAC boosts the top of the band by the same amount, so the analog output is flat.
  3. The cost. It costs a little headroom, since the boosted samples can exceed full scale.

Answer the hold droops 2.42 dB at 0.4fs, and an inverse-sinc FIR filter before the DAC must boost the top of the band by the same amount.

Check

A 17 kHz tone is sampled at 10 kHz with no anti-aliasing filter. At what frequency does it appear?

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

Check

A zero-order-hold DAC runs at 44.1 kHz. What's its response at 18 kHz?

Check

A digital lowpass filter with cutoff ω = 0.25π runs inside a system sampling at 8 kHz. What's the equivalent analog cutoff?

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

Check

What SNR does an ideal 12-bit quantizer give for a full-scale sine?

Check

A 12-bit converter is oversampled by 4 and its output filtered to the original band. What in-band SNR results (no noise shaping)?

Check

Only one sample is nonzero, x[0] = 1. What value does ideal sinc reconstruction give at t = 0.5T?

Check

A zero-order-hold DAC runs at 44.1 kHz and is used up to 0.2 of its sample rate.

(a)

How much does it droop at the top of that band?

(b)

What delay does the hold add?

Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.

Check

A tone at a fraction f of the sample rate s (between half and all of it) is sampled with no anti-aliasing filter.

Step 1

At what frequency does it appear?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Explain why

Why is aliasing impossible to undo after sampling?

Practice

Keep practicing

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