Sampling theorem and aliasing

States the sampling theorem, explains aliasing, anti-aliasing and reconstruction, and shows how to find Nyquist rates and alias frequencies.

Drafted with Aria, reviewed by the AiCanCode.org team. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Every data-acquisition system, digital multimeter and PLC analogue input samples a continuous signal. Choose the sampling rate or the anti-aliasing filter badly and a 1.3 kHz vibration can show up as a perfectly believable 700 Hz component — an error no later processing can remove. The sampling theorem tells you how fast to sample and what must happen before the ADC.

Key ideas

Ideal (impulse) sampling. Multiplying x(t) by an impulse train of period Ts gives xs(t) = Σ x(nTs) δ(t − nTs). In frequency, the spectrum of xs is the original spectrum repeated at every multiple of fs = 1/Ts, scaled by 1/Ts.

Sampling theorem. A signal band-limited to fm (no content above fm Hz) is completely determined by its samples if fs > 2fm. The copies of the spectrum then do not overlap, and an ideal low-pass filter with cut-off between fm and fs − fm recovers x(t) exactly.

  • 2fm is the Nyquist rate (a property of the signal); fs/2 is the Nyquist (folding) frequency (a property of the sampler).
  • For a pure sinusoid, sampling at exactly 2fm is not enough: the samples may all fall on zero crossings. Hence the strict inequality.

Aliasing. If fs < 2fm, shifted copies overlap. A component at f is indistinguishable from one at |f − k·fs| for any integer k; it appears at the value of |f − k·fs| that lies between 0 and fs/2. Once aliased, the error cannot be removed digitally.

Preventing aliasing in practice

  • Put an analogue anti-aliasing low-pass filter before the ADC; it removes noise and interference above fs/2 as well as signal content.
  • Real filters have a transition band, so practical systems sample at 2.5–10 times the highest frequency of interest (oversampling). Audio CDs use 44.1 kHz for a 20 kHz band.

Reconstruction. The ideal reconstruction filter has impulse response sinc, which interpolates the samples (Whittaker–Shannon formula below). Practical DACs use a zero-order hold, whose sinc-shaped frequency response droops in the passband and leaves images that must be smoothed by a reconstruction filter.

Practical sampling. Natural (gated) sampling with finite pulse width and flat-top (sample-and-hold) sampling still satisfy the theorem; flat-top sampling adds the aperture effect, a sinc amplitude distortion.

Bandwidth of combined signals — needed to find Nyquist rates:

  • Sum x1 + x2: bandwidth = the larger of the two.
  • Product x1·x2: bandwidth = sum of the two (multiplication ⇒ convolution of spectra). So x²(t) has twice the bandwidth of x(t).
  • Modulation by cos 2πf0t: highest frequency becomes f0 + fm.

Band-pass sampling. A signal confined to fL … fH can be sampled below 2fH, as low as 2B with B = fH − fL when fH is an integer multiple of B. It is a special case, not the default.

Formulas

  • fs > 2fm — sampling theorem; fN = 2fm is the Nyquist rate.
  • Ts = 1/fs, maximum Ts < 1/(2fm) — Nyquist interval.
  • Xs(f) = fs Σ X(f − k fs) — spectrum of the ideally sampled signal.
  • fa = |f − k·fs|, choosing k so that 0 ≤ fa ≤ fs/2 — apparent (alias) frequency.
  • x(t) = Σ x(nTs) sinc((t − nTs)/Ts) with sinc(u) = sin(πu)/(πu) — ideal reconstruction.
  • Ω = 2πf/fs — digital frequency of a sampled sinusoid (rad/sample).
  • |H_ZOH(f)| = Ts·|sinc(f·Ts)| — zero-order-hold response.

Symbols: fs sampling frequency (Hz, samples/s); Ts sampling interval (s); fm highest signal frequency (Hz); fa alias frequency (Hz); k integer; B bandwidth (Hz); Ω digital frequency (rad/sample).

Worked examples

Example 1 (standard). x(t) = 3 cos(2π·400t) + 2 cos(2π·1300t) is sampled at fs = 2 kHz and reconstructed with an ideal low-pass filter of cut-off 1 kHz. Find the Nyquist rate and the reconstructed signal.

  1. Highest frequency fm = 1300 Hz ⇒ Nyquist rate = 2 × 1300 = 2600 Hz. Since 2000 < 2600, aliasing occurs.
  2. 400 Hz < fs/2 = 1000 Hz: unchanged.
  3. 1300 Hz > 1000 Hz: fa = |1300 − 2000| = 700 Hz (cosines keep their amplitude; the phase sign flips, but for a zero-phase cosine that changes nothing).
  4. The filter passes everything below 1 kHz.
  5. Nyquist rate 2.6 kHz; output = 3 cos(2π·400t) + 2 cos(2π·700t) — a false 700 Hz tone.

Example 2 (GATE level). Find the Nyquist rate of (a) x1(t) = [sin(200πt)/(πt)]² and (b) x2(t) = x1(t)·cos(2π·1000t). (c) A 7 kHz tone is sampled at 10 kHz; at what frequency does it appear, and what is its digital frequency?

  1. (a) sin(200πt)/(πt) has a rectangular spectrum up to 200π/2π = 100 Hz. Squaring convolves the spectrum with itself: bandwidth 2 × 100 = 200 Hz. Nyquist rate = 400 Hz.
  2. (b) Multiplying by a 1000 Hz cosine shifts the spectrum to 1000 ± 200 Hz; highest frequency 1200 Hz. Nyquist rate (low-pass sampling) = 2400 Hz.
  3. (c) fs/2 = 5 kHz; fa = |7 − 10| = 3 kHz.
  4. Digital frequency Ω = 2π × 7/10 = 1.4π rad/sample ≡ 1.4π − 2π = −0.6π, i.e. 0.6π in magnitude — the same as a 3 kHz tone (2π × 3/10 = 0.6π).
  5. (a) 400 Hz; (b) 2.4 kHz; (c) appears at 3 kHz, Ω = 0.6π rad/sample.

Common mistakes

  • Using the fundamental instead of the highest harmonic when finding fm for a periodic waveform.
  • Taking the Nyquist rate of x²(t) or x1·x2 as that of the individual signals — multiplication widens the bandwidth.
  • Sampling a sinusoid at exactly 2fm and assuming it can be recovered.
  • Computing an alias as fs − f when f > fs (e.g. 2.3 kHz at fs = 1 kHz aliases to 300 Hz, not a negative number).
  • Placing the anti-aliasing filter after the ADC — by then the damage is done.
  • Confusing the Nyquist rate (2fm) with the Nyquist frequency (fs/2).

For GATE IN

Expect NAT questions on the Nyquist rate of sums, products and squares of band-limited signals (sinc-type expressions are common), the apparent frequency after sampling, the output of a sample-and-reconstruct chain with an ideal low-pass filter, and the minimum sampling rate for a given ADC chain. Practise translating sin(at)/(πt) into a bandwidth and finding aliases quickly.

Quick check

  1. Nyquist rate of cos(2π·300t) + sin(2π·450t)?
  2. A 9 kHz tone is sampled at 8 kHz. Apparent frequency?
  3. Nyquist rate of sinc(100t) with sinc(u) = sin(πu)/(πu)?
  4. Why is an analogue filter needed before the ADC rather than a digital one after it?
  5. Maximum sampling interval for a 2.5 kHz band-limited signal? Answers: 1. 900 Hz. 2. |9 − 8| = 1 kHz. 3. Bandwidth 50 Hz ⇒ 100 Hz. 4. Aliased components land inside the band and cannot be separated afterwards. 5. Ts < 1/5000 s = 0.2 ms.

Try answering each one aloud before you open it.

  1. 1.What is the sampling theorem?Concept

    The sampling theorem, also known as the Nyquist-Shannon sampling theorem, states that a continuous signal can be completely represented in its samples and fully reconstructed if it is sampled at a rate greater than twice its highest frequency component. This minimum rate is called the Nyquist rate.

  2. 2.Explain aliasing in the context of signal processing.Concept

    Aliasing occurs when a signal is sampled at a rate that is insufficient to capture its changes accurately, specifically below the Nyquist rate. This results in different signals becoming indistinguishable from each other when sampled, causing distortion in the reconstructed signal.

  3. 3.Why is the Nyquist rate important in digital signal processing?Application

    The Nyquist rate is crucial because it defines the minimum sampling rate required to accurately capture and reconstruct a continuous signal without introducing aliasing. Sampling below this rate can lead to loss of information and distortion in the signal.

  4. 4.What happens if a signal is sampled below its Nyquist rate?Application

    If a signal is sampled below its Nyquist rate, aliasing occurs. This means that high-frequency components of the signal are misrepresented as lower frequencies, leading to distortion and loss of information in the reconstructed signal.

  5. 5.How can aliasing be prevented in signal processing?Application

    Aliasing can be prevented by ensuring that the sampling rate is at least twice the highest frequency present in the signal. Additionally, using an anti-aliasing filter to remove high-frequency components before sampling can help prevent aliasing.

  6. 6.Explain the role of anti-aliasing filters in signal processing.Application

    Anti-aliasing filters are used to remove high-frequency components from a signal before it is sampled. This ensures that the signal's frequency content is within the Nyquist limit, preventing aliasing and ensuring accurate signal reconstruction.

  7. 7.What is the relationship between the sampling frequency and the bandwidth of a signal?Concept

    The sampling frequency must be at least twice the bandwidth of the signal to satisfy the Nyquist criterion. This ensures that all frequency components of the signal are captured accurately without aliasing.

  8. 8.A signal has a maximum frequency of 5 kHz. What is the minimum sampling rate required to avoid aliasing?Numerical

    The Nyquist rate is 2 × 5 kHz = 10 kHz, and the sampling rate must exceed it (strictly, for a component exactly at 5 kHz). In practice an anti-aliasing filter with a finite transition band is used, so a real system would sample at perhaps 12.5–25 kHz or more, giving the filter room to attenuate everything above fs/2.

  9. 9.If a signal is sampled at 8 kHz and the highest frequency component is 3 kHz, will aliasing occur?Numerical

    The Nyquist rate for a signal with a highest frequency component of 3 kHz is 2 × 3 kHz = 6 kHz. Since the sampling rate of 8 kHz is above the Nyquist rate, aliasing will not occur.

  10. 10.Describe a real-world application where sampling theorem is crucial.Application

    In digital audio processing, the sampling theorem is crucial to ensure high-quality sound reproduction. For example, CDs use a sampling rate of 44.1 kHz to accurately capture audio signals up to 20 kHz, which is the upper limit of human hearing, thus preventing aliasing and ensuring clear sound.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?