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
- Why sample at all 5 min
- The sampling theorem 15 min
- Aliasing, demonstrated 10 min
- 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?
- 6 kHz
- 4 kHz
- 2 kHz
- 14 kHz
Take away
- Sample above twice the highest frequency.
- Filter first. An anti-aliasing filter removes what you cannot capture.
- Aliases cannot be undone after sampling.
Before next week
Reading
Chapter 4, sections 4.1 to 4.3Office hours Tuesday