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 copies the signal's spectrum at every multiple of ; 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 , against the tone's true frequency: .
- Below the tone comes through unchanged. Above it the frequency folds back, a zigzag between 0 and .
- 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?
3.2 dB. A zero-order hold's frequency response is , which at 20 kHz (0.454 of ) is 0.694, or −3.17 dB, and at the Nyquist frequency −3.92 dB. Converters either compensate with a digital boost filter rising toward , or oversample so the band of interest sits on the flat part of the curve.
Name it
The sampled spectrum
Sampling every T seconds gives with
copies of the analog spectrum every , with ω = ΩT. If is bandlimited to and (the Nyquist rate), the copies don't overlap and can be recovered exactly; otherwise they alias: a tone at f appears at .
Reconstruction
- Ideal: lowpass the impulse train at , which interpolates with sincs: .
- Zero-order hold: holding each value for T multiplies the spectrum by : a droop of 3.92 dB at , half a sample of delay, and images at multiples of that a smoothing filter must remove.
Discrete-time processing of continuous-time signals
C/D conversion, a discrete-time system , then ideal D/C behaves like an analog filter
so a digital cutoff means an analog cutoff 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 . 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
- 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.
- Butterworth order. so it takes a 21st-order analog filter.
- Oversample instead. Oversampling by 64 moves the first aliasing band to 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
- The 30 kHz tone.
- The 25 kHz tone.
- Hold droop at 20 kHz. On playback through a zero-order hold, with 20/44.1 = 0.4535:
- 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.4. How much does it droop there, and what must a compensating digital filter do?
Show the solution
- Hold response at 0.4. That's a droop of 2.42 dB.
- 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.
- The cost. It costs a little headroom, since the boosted samples can exceed full scale.
Answer the hold droops 2.42 dB at 0.4, 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°.
Step 2
At what digital frequency (radians per sample)?
Step 3
What gain would a zero-order-hold DAC give that alias on the way back out?
Explain why
Why is aliasing impossible to undo after sampling?
Sampling records only the values at the sample instants, and a tone at f and a tone at pass through exactly the same values at every one of them, since their phases differ by a whole number of cycles each sample. In the spectrum this shows up as the copies of the analog spectrum at multiples of : if the signal had content above , the copies overlap and add, and the sum no longer says which part came from which frequency. No processing after the converter can separate them, because the information that would distinguish them was never captured. The only cure is to remove the offending content before sampling, with an analog anti-aliasing filter, or to sample fast enough that there is none.
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.