Sampling and aliasing
Signals and systems
PhD. Alberth Ronal Tamo Calla
Signals and Systems Topics
Domain Topic Discrete Time Continuous Time
Time Signals ✔ ✔
Systems
Convolution
Frequency Fourier series ✔ ✔
Fourier transforms
Frequency response
Generalized z / Laplace Transforms
Frequency
Transfer Functions
System Stability
Mixed Signal Sampling ➔
5-2
Introduction
• Conversion of signals
Sampling: Continuous-Time to Discrete-Time
Reconstruction: Discrete-Time to Continuous-Time
f0 = 440;
fs = 24*f0;
Ts = 1/fs;
sampling tmax = 1/f0;
t = 0 : Ts : tmax;
x = cos(2*pi*f0*t);
reconstruction plot(t, x);
figure;
stem(t, x);
cosine at 440 Hz sampling rate: 10560 Hz
sampling period: 94.7 ms
5-3
Sampling and Reconstruction
• Sampling Theorem
Continuous-time signal x(t) with frequencies no higher than fmax can be
reconstructed exactly from its samples x(n Ts) if samples taken at sampling rate
of fs > 2 fmax
• Sampling audio CD signals
Normal human hearing is from about 20 Hz to 20 kHz
Filter analog continuous-time signal to pass frequencies up to 20 kHz and
reject frequencies above 22 kHz
Sample filtered signal at sampling rate of 44100 Hz
• Reconstruction fills in missing values between sampling times (e.g.
interpolation)
5-4
Discrete-Time Signals
• Many signals originate in continuous time
Example: Talking on smart phone or playing live music
• Sample continuous-time signal Sampled analog waveform
at equally-spaced points in time s(t
) T
to obtain a sequence of numbers s
s[n] = s(n Ts) for n {…, -1, 0, 1, …} t
T
How to choose sampling period Ts ? s
• Using a formula
x[n]
x[n] = – 5n + 3
n2
How does it look in continuous time?
n = 0 : 7;
x = n.^2 - 5*n + 3;
stem(n, x); n
5-5
Sampling Sinusoidal Signals
• Analog continuous-time signals
Sinusoids model physical quantities such as musical tones
Sums of sinusoids can represent general continuous-time signals
• Sampling sinusoidal signal x(t) = A cos(w t + f)
x[n] = x ( n Ts ) = Acos (w n Ts + f ) = Acos (ŵ n + f )
where the normalized radian frequency is
w f
ŵ = w Ts = = 2p
fs fs
Discrete time n abstracts away continuous time information
Discrete-time frequency ŵ abstracts away continuous-time frequency
information
5-6
Discrete-Time Frequency
• Examples
Application Sampling Rate Continuous-Time Discrete-Time Frequency f
Frequency ŵ = 2p
Speech 8000 Hz 220 Hz 2 p 11/400 = 0.1728 fs
Audio 44100 Hz 441 Hz 2 p 1/100 = 0.0628
Audio 48000 Hz 1320 Hz 2 p 11/400 = 0.1728
• Comparing first and third rows
n = 1 : 48000;
Same ŵ gives same discrete-time signal x[n] wHat = 0.1728;
x = cos(wHat*n);
Different tone when x[n] is played at sound(x, 8000);
sampling rate 8000 Hz vs. 48000 Hz pause(3);
sound(x, 48000);
5-7
How to Pick a Sampling Rate?
• Sampling theorem fs =500 Hz
Sampling rate fs > 2 fmax
2.5x
Larger fs tracks waveform shape better oversampling
in time
fs = 5 fmax = 2.5 (2 fmax) is
2.5 times oversampling
fs =2000 Hz Cosine at
f0 =100 Hz
10x
oversampling Used 10x
oversampling
to generate
continuous-
time plot
5-8
How to Pick a Sampling Rate?
f0 = 100;
• MATLAB code tmin = -0.01; tmax = 0.02; fs =500 Hz
fs = 5*f0; Ts = 1/fs;
For previous slide wHat = 2*pi*f0/fs; 2.5x
nmin = round(tmin / Ts); oversampling
nmax = round(tmax / Ts);
fs =2000 Hz n = nmin : nmax;
x2 = cos(wHat*n);
10x figure; stem(n, x2);
oversampling xlabel('Sample Index n');
title('100-Hz Sinusoid Sampled at 500 Hz');
f0 = 100;
tmin = -0.01; tmax = 0.02; Cosine at
fs = 20*f0; Ts = 1/fs; f0 = 100;
tmin = -0.01; tmax = 0.02;
f0 =100 Hz
wHat = 2*pi*f0/fs;
nmin = round(tmin / Ts); fs = 20*f0; Ts = 1/fs; Used 10x
nmax = round(tmax / Ts); t = tmin : Ts : tmax; oversampling
n = nmin : nmax; x = cos(2*pi*f0*t);
to generate
x1 = cos(wHat*n); figure;
figure; stem(n, x1); plot(t, x); continuous-
xlabel('Sample Index n'); xlabel('Time (s)'); time plot
title('100-Hz Sinusoid Sampled at 2000 title('Continuous-Time Sinusoid at 100 Hz'); 5-9
Hz');