Week 9 — Sampling, Aliasing, ADCs, and Reconstruction

Course 6 syllabus

Overview

This is the week the course crosses from the continuous (analog) world into the discrete (digital) one — the single most consequential transition in all of signal processing. The sampling theorem tells us precisely when a continuous signal can be perfectly reconstructed from its samples (when sampled above twice its highest frequency), and aliasing is what goes wrong when we violate that bound: high frequencies masquerade as low ones, irreversibly corrupting the data. Every digital oscilloscope, audio interface, software-defined radio, and sensor data path lives or dies by these ideas, and the consequences are concrete and often catastrophic if ignored.

The beauty is that sampling is best understood as a frequency-domain phenomenon, which is exactly why Week 8 came first. Sampling in time replicates the spectrum periodically in frequency; if the replicas don’t overlap (Nyquist satisfied), reconstruction is perfect; if they overlap (undersampling), the overlap is aliasing. You will see this with your own eyes: by feeding a known sine into a sampler and slowly raising its frequency past Nyquist, you will watch the apparent frequency fold back down — the most visceral demonstration in the course.

On the bench you bring the Jetson into play as a real data-acquisition system: an op-amp anti-alias filter (Weeks 6–7) in front of an ADC, sampling a signal, and reconstructing it. This week rests entirely on Week 8’s Fourier framework and is the immediate setup for Week 10, where the sampled signals are finally processed with the DFT/FFT and digital filters.

Readings

  • O-S&S Ch. 7: The sampling theorem, impulse-train sampling and the spectral replication picture, aliasing, reconstruction with an ideal low-pass, and the zero-order hold. Extract: the spectral-replication derivation and the Nyquist condition.
  • O-DSP Ch. 4: Sampling of continuous-time signals — the C/D (continuous-to-discrete) and D/C converters, the relationship between continuous frequency \(\Omega\) and discrete frequency \(\omega=\Omega T\), and the detailed effects of undersampling. Extract: the normalized-frequency mapping and the rigorous reconstruction conditions.
  • PEI (ADC/DAC sections): Practical converters — successive-approximation and sigma-delta ADCs, resolution and quantization, sample-and-hold, and DACs. Extract: how real converters work and their key specs (resolution, sample rate, ENOB).

Key Concepts

The sampling theorem (Nyquist–Shannon)

A continuous signal \(x(t)\) band-limited to \(|f| < f_\text{max}\) is completely determined by its samples \(x[n]=x(nT)\) provided the sampling rate satisfies

\[ f_s = \frac1T > 2 f_\text{max}. \]

The threshold \(2f_\text{max}\) is the Nyquist rate; \(f_s/2\) is the Nyquist frequency (the highest frequency representable at sample rate \(f_s\)). Above the Nyquist rate, perfect reconstruction is possible in principle. The bound is not a rule of thumb — it is exact, and it falls directly out of the spectral-replication picture below.

Why: sampling replicates the spectrum

Sampling is multiplication by an impulse train \(p(t)=\sum_n \delta(t-nT)\). By the convolution theorem (Week 8), multiplication in time is convolution in frequency, and the transform of an impulse train is another impulse train (spacing \(f_s\)). So the spectrum of the sampled signal is the original spectrum \(X(f)\) replicated at every multiple of \(f_s\):

\[ X_s(f)=\frac1T\sum_{k=-\infty}^{\infty} X(f-kf_s). \]

If \(f_s > 2f_\text{max}\), the replicas don’t overlap and the original is recoverable by an ideal low-pass that keeps the baseband copy. If \(f_s < 2f_\text{max}\), adjacent replicas overlap — the overlap region is corrupted, and that corruption is aliasing.

Aliasing and folding

When undersampled, a frequency \(f_0 > f_s/2\) appears as a lower alias frequency \(f_\text{alias}=|f_0 - k f_s|\) folded into the baseband \([0, f_s/2]\). Once aliased, the information is unrecoverable — two different continuous signals produce identical samples. The classic visuals (a wagon wheel turning backward on film, a sampled sine appearing slower than it is) are exactly this folding. The only defense is to band-limit before sampling.

The anti-alias filter

Because real signals (and noise) are never perfectly band-limited, you must place an analog anti-alias low-pass filter before the ADC, with its cutoff below \(f_s/2\), to attenuate everything that would otherwise alias. This is a direct application of Weeks 6–7: an op-amp active low-pass with cutoff set by the sample rate. Filter sharpness vs sample-rate overhead is a real design tradeoff — a gentle filter needs oversampling headroom; a sharp filter is complex but allows \(f_s\) closer to \(2f_\text{max}\).

Quantization and the ADC

Sampling discretizes time; quantization discretizes amplitude. An \(N\)-bit ADC maps the input range into \(2^N\) levels with step \(\Delta=\text{FSR}/2^N\). Modeling quantization error as uniform noise on \([-\Delta/2,\Delta/2]\) gives the signal-to-quantization-noise ratio

\[ \text{SQNR} \approx 6.02\,N + 1.76\ \text{dB}, \]

i.e. ~6 dB per bit. Real ADCs achieve fewer effective bits (ENOB) than their nominal resolution due to noise and distortion. ADC architectures: successive-approximation (SAR) for moderate speed/resolution, sigma-delta for high resolution at lower bandwidth (oversampling + noise shaping), flash for very high speed.

Reconstruction and the zero-order hold

To get back to continuous time, a DAC outputs samples held constant for one period (zero-order hold), then a reconstruction (anti-imaging) low-pass smooths the staircase. The ZOH itself imposes a \(\text{sinc}\) amplitude roll-off \(\big(\tfrac{\sin(\pi f/f_s)}{\pi f/f_s}\big)\) across the band, sometimes compensated digitally. Ideal reconstruction would convolve samples with a sinc (the ideal low-pass impulse response) — the rectangle↔︎sinc pair from Week 8 made physical.

Theory Exercises

  1. Derive the spectral-replication formula \(X_s(f)=\frac1T\sum_k X(f-kf_s)\) from impulse-train sampling and the convolution theorem.
  2. From the replication picture, derive the Nyquist condition \(f_s>2f_\text{max}\) for non-overlapping replicas.
  3. A 7 kHz sine is sampled at 10 kHz. Compute the alias frequency. Repeat for 13 kHz and 23 kHz sampled at 10 kHz, and state the general folding rule.
  4. Derive the discrete frequency mapping \(\omega=\Omega T\) and explain why discrete-time frequency is periodic with period \(2\pi\).
  5. Derive SQNR \(\approx 6.02N+1.76\) dB from the uniform-quantization-noise model.
  6. Design an anti-alias filter for \(f_s=20\) kHz: choose a cutoff and order so that signals at \(f_s/2\) and above are attenuated by a target amount; state the oversampling headroom your choice requires.
  7. Derive the zero-order-hold frequency response and its sinc roll-off across the passband.

Lab / Bench Work

Witness aliasing (the centerpiece): Set the scope (or the Jetson ADC) to a fixed, modest sample rate. Feed a sine and slowly increase its frequency past the Nyquist frequency. Watch the apparent frequency on the sampled display fold back down and even appear to run backward. Record apparent vs actual frequency and confirm the folding formula \(f_\text{alias}=|f_0-kf_s|\).

Anti-alias front end: Build an op-amp active low-pass (from Week 7) as an anti-alias filter ahead of the sampler with cutoff below \(f_s/2\). Show that a high-frequency tone that aliased without the filter is now suppressed and no longer corrupts the baseband.

Jetson data acquisition: Use an ADC with the Jetson (I²C/SPI, with the logic level converter as needed for any 5 V parts) to sample a conditioned analog signal. Capture a buffer of samples to disk; in Python on the Jetson, plot the time series and confirm the sample rate and amplitude calibration.

Reconstruction: Output samples through a DAC (or PWM + RC reconstruction filter), capture the reconstructed waveform on the scope, and observe the zero-order-hold staircase and the smoothing effect of the reconstruction filter.

Qucs-S (ngspice): Simulate the anti-alias filter’s response and confirm the attenuation at \(f_s/2\) meets your design target.

Measurement Methodology

  • Choose \(f_s\) deliberately: record the exact sample rate; all alias predictions depend on it. On the Jetson, verify the actual achieved sample rate (scheduling jitter can make it differ from the requested rate — a real embedded-systems effect).
  • Calibrate amplitude: map ADC codes to volts using the reference and the measured full-scale; confirm against the Fluke.
  • Sampling jitter: note that timing jitter on the sample clock adds noise that grows with input frequency — a practical limit on high-frequency sampling fidelity.
  • Anti-alias verification: measure baseband corruption with and without the filter for an out-of-band tone; the difference is the filter’s protection.
  • Reconcile: observed alias frequencies vs the folding formula; ADC SQNR vs \(6.02N+1.76\) dB; reconstruction roll-off vs the ZOH sinc.

Expected baselines: Alias frequencies matching \(|f_0-kf_s|\) exactly (this is arithmetic, not tolerance). Measured ADC noise floor consistent with its ENOB (a few bits below nominal). Anti-alias filter reducing an out-of-band tone by the designed attenuation. Visible ZOH staircase smoothed by the reconstruction filter.

Connections

Sampling is Week 8’s Fourier framework applied to an impulse train — the convolution theorem is the whole proof. The anti-alias and reconstruction filters are direct applications of Weeks 6–7. The continuous-to-discrete frequency mapping \(\omega=\Omega T\) and the periodicity of discrete-time frequency set up everything in Week 10, where the sampled signals are processed with the DFT/FFT and digital filters. The Jetson acquisition pipeline built here is the same embedded-sensor data path used in Course 1 (IMU/sensor sampling) and Course 4 (ADC/GPIO at the hardware/OS boundary). The 6 dB/bit rule is the bridge between analog signal quality and digital word length.

Further Reading

  • Oppenheim, Willsky & Nawab, Signals and Systems, Ch. 7 — sampling theorem and reconstruction.
  • Oppenheim & Schafer, Discrete-Time Signal Processing, Ch. 4 — rigorous C/D and D/C conversion and undersampling.
  • Scherz & Monk, Practical Electronics for Inventors — ADC/DAC architectures and specs.
  • Walt Kester (Analog Devices), Data Conversion Handbook (reference) — real ADC/DAC behavior, ENOB, and anti-alias design.