Signals and Systems, Lecture 7

Sampling, and when it goes wrong

The Nyquist rate, aliasing, and how to choose a sampling frequency.

Department of Electrical EngineeringSample lectureWeek 7

Today

  1. Why sample at all 5 min
  2. The sampling theorem 15 min
  3. Aliasing, demonstrated 10 min
  4. Quiz and worked problem 20 min

Theorem

The Nyquist condition

fs > 2 fmax
fs
Sampling frequency, samples per second
fmax
Highest frequency present in the signal
2fmax
The Nyquist rate, the minimum to avoid aliasing
Example
Audio to 20 kHz needs more than 40 kHz; CDs use 44.1 kHz

Demo

See aliasing in five lines

    import numpy as np
    t = np.arange(0, 1, 1/100)          # fs = 100 Hz
    x = np.sin(2*np.pi*90*t)            # a 90 Hz tone
    # 90 Hz is above fs/2, so it appears at 10 Hz
    plt.plot(t, x)
  

Check

A 6 kHz tone is sampled at 8 kHz. What frequency appears?

  1. 6 kHz
  2. 4 kHz
  3. 2 kHz
  4. 14 kHz

Take away

Before next week

Reading

Chapter 4, sections 4.1 to 4.3Office hours Tuesday