Transcript Linearity
EE 345S Real-Time Digital Signal Processing Lab
Spring 2006
Sampling and Aliasing
Prof. Brian L. Evans
Dept. of Electrical and Computer Engineering
The University of Texas at Austin
Lecture 4
http://courses.utexas.edu/
Review
Sampling: Time Domain
• Many signals originate as continuous-time
signals, e.g. conventional music or voice
• By sampling a continuous-time signal at
isolated, equally-spaced points in time, we
obtain a sequence of numbers s
t
sk sk Ts
sampled
Ts
k {…, -2, -1, 0, 1, 2,…}
Ts is the sampling period.
t
Ts
ssampled t s(t ) t k Ts
k
impulse train
s(t)
Sampled analog waveform
4-2
Review
Sampling: Frequency Domain
• Sampling replicates spectrum of continuous-time
signal at integer multiples of sampling frequency
• Fourier series of impulse train where ws = 2 p fs
1
T (t ) t k Ts 1 2 cos(w s t ) 2 cos(2 w s t ) . . .
s
Ts
k
g (t ) f (t ) Ts (t )
1
f (t ) 2 f (t ) cos(w s t ) 2 f (t ) cos(2 w s t ) . . .
Ts
Modulation
by cos(2 ws t)
Modulation
by cos(ws t)
F(w)
G(w)
w
-2pfmax 2pfmax
2ws
ws
ws
2ws
gap if and onlyif 2pf max 2pf s 2pf max f s 2 f max
w
4-3
Review
Amplitude Modulation by Cosine
• Multiplication in time: convolution in Fourier
domain
y t f t cosw 0t
Y w
1
F w p w w 0 w w 0
2p
• Sifting property of Dirac delta functional
xt t xt d xt
xt t t0 t0 xt d xt t0
• Fourier transform property for modulation by
a cosine Y w 1 F w w 1 F w w
2
0
2
0
4-4
Review
Amplitude Modulation by Cosine
• Example: y(t) = f(t) cos(w0 t)
Assume f(t) is an ideal lowpass signal with bandwidth w1
Assume w1 << w0
Y(w) is real-valued if F(w) is real-valued
F(w)
Y(w)
½Fw w0
½Fw w0
1
½
w1
0
w1
w
w0 w1 w0 + w1
w0
0
w0 w1
w0
w0 + w1
• Demodulation: modulation then lowpass filtering
• Similar derivation for modulation with sin(w0 t)
4-5
w
Shannon Sampling Theorem
• Continuous-time signal x(t) with frequencies no
higher than fmax can be reconstructed from its
samples x(k Ts) if samples taken at rate fs > 2 fmax
Nyquist rate = 2 fmax
Nyquist frequency = fs / 2
What happens
if fs = 2 fmax?
• Example: Sampling audio signals
Human hearing is from about 20 Hz to 20 kHz
Apply lowpass filter before sampling to pass frequencies
up to 20 kHz and reject high frequencies
Lowpass filter needs 10% of maximum passband frequency
to roll off to zero (2 kHz rolloff in this case)
4-6
Sampling Theorem
•
•
•
•
Assumption
Continuous-time signal has
no frequency content above
fmax
Sampling time is exactly the
same between any two
samples
Sequence of numbers
obtained by sampling is
represented in exact
precision
Conversion of sequence to
continuous time is ideal
In Practice
4-7
Bandwidth
• Bandwidth is defined as
non-zero extent of spectrum
in positive frequencies
Lowpass spectrum on right:
bandwidth is fmax
Lowpass Spectrum
f
-fmax fmax
Bandpass Spectrum
Bandpass spectrum on right:
bandwidth is f2 – f1
–f1
–f2
f1
• Definition applies to both
continuous-time and discrete-time signals
• Alternatives to “non-zero extent”?
f
f2
4-8
Bandpass Sampling
• Bandwidth: f2 – f1
• Sampling rate fs must
greater than analog
bandwidth
fs
2 f2
f2 / f2 f1
• For replicas of bands to be
centered at origin after
sampling
Bandpass Spectrum
–f2
–f1
f
f1
f2
Sample at fs
Sampled Bandpass Spectrum
fcenter = ½ (f1 + f2) = k fs
• Lowpass filter to extract
baseband
–f2
–f1
f
f1
f2
4-9
Sampling and Oversampling
• As sampling rate increases, sampled waveform
looks more like original
• In some applications, e.g. touchtone decoding,
frequency content matters not waveform shape
• Zero crossings: frequency content of a sinusoid
– Distance between two zero crossings: one half period.
– With sampling theorem satisfied, a sampled sinusoid
crosses zero the right number of times even though its
waveform shape may be difficult to recognize
• DSP First, Ch. 4, Sampling & interpolation demo
http://users.ece.gatech.edu/~dspfirst
4 - 10
Aliasing
• Analog sinusoid
x(t) = A cos(2p f0 t + f)
• Sample at Ts = 1/fs
x[n] = x(Tsn) =
A cos(2p f0 Ts n + f)
• Keeping the sampling
period same, sample
y(t) = A cos(2p (f0 + l fs) t + f)
where l is an integer
y[n] = y(Tsn)
= A cos(2p(f0 + lfs)Tsn + f)
= A cos(2pf0Tsn + 2plfsTsn + f)
= A cos(2pf0Tsn + 2pln + f)
= A cos(2pf0Tsn + f)
= x[n]
Here, fsTs = 1
Since l is an integer,
cos(x + 2 p l) = cos(x)
• y[n] indistinguishable
from x[n]
4 - 11
Aliasing
• Since l is any integer, a countable but infinite
number of sinusoids will give same sequence of
samples
• Frequencies f0 + l fs for l 0 are called aliases of
frequency f0 with respect to fs
All aliased frequencies appear to be the same as f0 when
sampled by fs
4 - 12
Folding
• Sampling w(t) with a
• Second source of
sampling period of
aliasing frequencies
Ts = 1/fs
• From negative
w[n]
w(T n)
frequency component
A cos(2 p ( f l f ) T n f )
of a sinusoid, -f0 + l fs,
A cos(2 p f T n 2p l f T n f )
s
0
0
w(t )where
A cos(
2 pany
( finteger
l is
0 l fs ) t f )
fs is the sampling rate
f0 is sinusoid frequency
s
s
s
s
s
A cos(2 p f 0 Ts n 2p l n f )
A cos(2 p f 0 Ts n f )
A cos(2 p f 0 Ts n f )
So w[n] = x[n] = x(Ts n)
x(t) = A cos(2 p f0 t + f)
4 - 13
Aliasing and Folding
Apparent
frequency (Hz)
• Aliasing and folding of a sinusoid sin(2 p finput t)
sampled at fs = 2000 samples/s with finput varied
fs = 2000 samples/s
1000
1000
2000
3000
4000
Input frequency, finput (Hz)
• Mirror image effect about finput = ½ fs gives rise
to name of folding
4 - 14
DSP First Demonstrations
• Web site: http://users.ece.gatech.edu/~dspfirst
• Aliasing and folding (Chapter 4)
• Strobe demonstrations (Chapter 4)
Disk attached to a shaft rotating at 750 rpm
Keep strobe light flash rate Fs the same
Increase rotation rate Fm (positive means counter-clockwise)
• Case I: Flash rate equal to rotation rate
Vector appears to stand still
When else does this phenomenon occur? Fm = l Fs
For Fm = 750 rpm, occurs at Fs = {375, 250, 187.5, …} rpm
4 - 15
Strobe Demonstrations
• Tip of vector on wheel:
p(t ) r e j ( 2 p Fm t )
r is radius of disk
is initial angle (phase) of vector
Fm is initial rotation rate in rotations per second
t is time in seconds
• For Fm = 720 rpm and r = 6 in, with pvector p
j ( 2 p 12 t )
j ( 24 p t )
2
2
initially vertical
p(t ) 6 e
6e
• Sample at Fs = 2 Hz (or 120 rpm), so Ts = ½ s,
vector stands still:
n p
p
j 24 p
j 12 p n
n
2
2 2
p[n] p(t ) |t Tsn p 6 e
6e
6j
2
4 - 16
Strobe Demonstrations
• Sampling and aliasing
– Sample p(t) at t = Ts n = n / Fs :
p[n ] r e
j 2 p
Fm
Fs
n
– No aliasing will occur if Fs > 2 | Fm |
– Consider Fm = -0.95 Fs which could occur for any
countably infinite number of Fm and Fs values:
p[n] r e j 2 p 0.95 n r e j 1.9p n
– Rotation will occur at rate of -1.9 p rad/flash, which
appears to go counterclockwise at rate of 0.1p rad/flash
4 - 17
Strobe Movies
• Fixes the strobe flash rate
• Increases rotation rate of shaft linearly with time
• Strobe initial keeps up with the increasing
rotation rate until Fm = ½ Fs
• Then, disk appears to slow down (folding)
• Then, disk stops and appears to rotate in the
other direction at an increasing rate (aliasing)
• Then, disk appears to slow down (folding) and
stop
• And so forth
4 - 18