Skip to content
Signal Theory

The sampling theorem and aliasing

Ideal sampling, the Nyquist-Shannon theorem with proof and sinc reconstruction, aliasing with examples, the anti-aliasing filter, oversampling and undersampling.

To process a signal with a computer it must be turned into a sequence of numbers, by taking its value at regular intervals: sampling. The natural question is whether something is lost this way. The sampling theorem gives a surprising answer: if the signal is band-limited and is sampled fast enough, nothing is lost, and the original signal can be reconstructed exactly. In this lesson we prove it and see what happens when the conditions are not met.

Ideal sampling

Sampling x(t) with period T_s (sampling frequency f_s = 1/T_s) gives the values x(nT_s). To study them with the Fourier transform they are represented as a train of weighted impulses:

    \[ x_s(t) = x(t)\sum_{n=-\infty}^{+\infty}\delta(t - nT_s) = \sum_n x(nT_s)\,\delta(t - nT_s) \]

The sampling theorem

Theorem (Nyquist-Shannon). If X(f) = 0 for |f| \gt B and f_s \gt 2B, the signal is determined by its samples and is reconstructed by

    \[ x(t) = \sum_{n=-\infty}^{+\infty} x(nT_s)\,\mathrm{sinc}\!\left(\frac{t - nT_s}{T_s}\right) \]

Proof. The impulse train is periodic, with Fourier series \sum_n \delta(t - nT_s) = \frac{1}{T_s}\sum_k e^{j2\pi kf_s t}. Multiplying x(t) by e^{j2\pi kf_s t} shifts the spectrum by kf_s, so

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

The spectrum of the sampled signal is the sum of replicas of the original spectrum, centred at all multiples of f_s. If f_s \gt 2B, the replicas, each 2B wide, do not overlap: an ideal low-pass filter with cut-off at f_s/2 and gain T_s isolates the central replica, that is X(f). In time, filtering means convolving with the filter’s impulse response, which is \mathrm{sinc}(t/T_s); convolving each impulse x(nT_s)\delta(t - nT_s) with the sinc gives the formula. ∎

Spectrum of a sampled signal: separate replicas and overlapping replicas
At the top the spectrum of the signal, of bandwidth B. In the middle the spectrum after sampling at a frequency above 2B: copies of the original spectrum centred at multiples of f_s, well separated. At the bottom, with a sampling frequency below 2B, the copies overlap and their sum (dashed) no longer allows the original to be recovered: this is aliasing.

The frequency 2B is called the Nyquist rate. Each sample “carries” a sinc, and the sum of the sincs passes exactly through all the samples and interpolates between them.

Aliasing

If f_s \lt 2B, the replicas overlap and the components above f_s/2 fold back into the low band, mixing with the real ones: this is aliasing, and after sampling there is no way to separate them. A component at frequency f appears at the nearest frequency |f - kf_s|, for the appropriate integer k.

Example. Sampling a 30 kHz tone at 44.1 kHz gives the same samples as a tone at 44.1 - 30 = 14.1 kHz: an audible whistle that was not in the original.

It is the same phenomenon that makes carriage wheels in films seem to turn backwards: the camera samples at 24 frames per second and a rotation that is too fast is “seen” as a slow one.

Sampling in practice

  • Anti-aliasing filter. Before the converter, an analogue low-pass filter removes everything above f_s/2, including unwanted noise: once sampled, it can no longer be removed.
  • Margin. A real filter has a transition band, so sampling is done somewhat above 2B. Audio CDs sample at 44.1 kHz for a signal up to 20 kHz: the filter has between 20 and 22.05 kHz to go from transparent to blocking.
  • Oversampling. Sampling much faster than necessary lets the analogue filter be simple, and the rest of the filtering is done digitally. Almost all modern audio converters work this way.
  • Reconstruction. A digital-to-analogue converter holds each sample constant until the next (zero-order hold): the output is a staircase, which a final low-pass filter smooths.

Sampling narrowband signals

The theorem requires f_s \gt 2B where B is the highest frequency. For a bandpass signal, for example a radio channel between 100 and 101 MHz, a sampling rate tied to the width of the band (1 MHz) is actually enough, as long as the replicas fall in the right places: this is undersampling, used in software-defined radios. Alternatively the signal is first shifted around zero with a mixer and then sampled.

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x