notesonly.in

One notebook for every subject — open it anywhere.

Log in

Sampling Theorem and Aliasing: Complete Beginner's Guide

The sampling theorem (Nyquist-Shannon) states that a signal containing no frequencies above fm can be perfectly reconstructed from its samples if the sampling rate fs is greater than 2 fm. Sampling replicates the signal's spectrum at multiples of fs; when fs is high enough these copies stay separated, and a low-pass filter can recover the original exactly.

This matters because it sets the fundamental speed requirement of every ADC on earth. Audio CDs use 44.1 kHz sampling because human hearing tops out near 20 kHz (2 x 20 = 40 kHz, plus margin). Violate the rule and aliasing strikes: high frequencies fold back and masquerade as lower ones, permanently corrupting the data — the wagon-wheel effect in movies, where spinning wheels appear to rotate backwards, is aliasing in time.

Key Concepts

  • Nyquist rate: 2 fm, the minimum sampling rate for a signal bandlimited to fm. The sampling rate must be strictly greater than this in practice.
  • Nyquist frequency: fs/2, the highest frequency that can be represented at sampling rate fs. (Note: Nyquist rate and Nyquist frequency are different quantities — a classic exam trap.)
  • Aliasing: when fs is less than 2 fm, spectral copies overlap and a frequency f appears as an impostor at |f - k fs| for integer k.
  • Anti-aliasing filter: an analog low-pass filter placed before the ADC that removes content above fs/2, so nothing exists that could alias.
  • Oversampling: sampling much faster than Nyquist to relax filter requirements and reduce quantization noise.
  • Reconstruction: ideal recovery uses sinc interpolation; practical DACs approximate it with zero-order hold plus a smoothing filter.

Formulas

  • Sampling condition: fs greater than 2 fm for perfect reconstruction of a signal bandlimited to fm.
  • Alias frequency: f_alias = |f - k fs|, where k is the integer bringing the result into [0, fs/2]. The dominant alias uses the nearest multiple.
  • Spectrum of sampled signal: Xs(f) = fs x sum of X(f - k fs) over all integers k — copies of the spectrum centered at every multiple of fs.
  • Minimum samples for a duration-T signal: N = fs x T samples.

Worked Example

A 3 kHz sine wave is sampled at fs = 5 kHz, below its Nyquist rate of 6 kHz. What frequency will the samples appear to represent?

  1. Check the rule: 2 fm = 6 kHz is greater than fs = 5 kHz, so aliasing will occur.
  2. The spectrum copies sit at multiples of 5 kHz: …, -5, 0, 5, 10, … kHz, each carrying the 3 kHz tone.
  3. The copy centered at 5 kHz places energy at 5 - 3 = 2 kHz, which lies inside the representable band [0, 2.5 kHz].
  4. Using the formula: f_alias = |3 - 1 x 5| = 2 kHz.
  5. Conclusion: the samples are indistinguishable from a genuine 2 kHz sine wave sampled at 5 kHz. The original 3 kHz information is irreversibly lost — no digital processing can tell them apart.

Had we sampled at 8 kHz instead (above 6 kHz), the copies at ±8 kHz would stay clear of the baseband and a low-pass filter would recover the 3 kHz tone perfectly.

Common Misconceptions

  • "Sampling at exactly 2 fm is enough." Mathematically borderline and practically useless — at exactly fs = 2 fm, phase determines whether you sample peaks or zero crossings. Always sample strictly above 2 fm.
  • "Aliasing can be fixed in software." No. Once aliased, the impostor frequency is identical to a real signal at that frequency; the original information is gone. Prevention (anti-alias filter) is the only cure.
  • "Higher sampling rates capture more detail of the same signal." Above Nyquist, extra samples add no new information about a bandlimited signal — oversampling helps filtering and noise, not information content.

Real-World Applications

  • Digital audio: 44.1 kHz (CD) and 48 kHz (video) standards are Nyquist choices for 20 kHz hearing.
  • Software-defined radio: ADC rates are chosen against the widest band to be captured.
  • Digital oscilloscopes: too low a sample rate shows a wrong, aliased waveform — a famous measurement pitfall.
  • Imaging: moiré patterns in photos of striped fabrics are spatial aliasing from the pixel grid.
  • Data acquisition: every sensor DAQ system includes an anti-alias filter matched to its sampling rate.

Sample faster than twice the highest frequency and the signal survives digitization intact; sample slower and frequencies fold back as aliases that can never be removed. The Nyquist rule is not a guideline — it is the hard boundary between faithful recording and permanent corruption.