Signal Processing Fundamentals – Part I Spectrum …enpklun/EIE327/Sampling2.pdf · 2 Signal...
Transcript of Signal Processing Fundamentals – Part I Spectrum …enpklun/EIE327/Sampling2.pdf · 2 Signal...
1
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
4. 4. Sampling and AliasingSampling and Aliasing
Sampler Ideal Low Pass Filter
2
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
Sampling• Most real signals are continuous-time (analogue)
signals• E.g. speech, audio, etc.
• Computers have much difficulty in handling continuous-time signals
• Need sampling⇒ Extract samples of the signal at some
particular time instants
3
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
Continuous-to-Discreteor
Analogue-to-Digital
x(t) x[n] = x(nTs)
Ts = 1/fs
TsWhat is the value of Ts?
Normal CD musicfs = 44.1kHz
Sampled atfs = 16kHz
Sampled atfs = 8kHz
4
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
f = 100Hz
f = 100Hzfs = 2000Hz
f = 100Hzfs = 500Hz
Sampling Sinusoids
5
( )φπ += ftAtx 2cos)(( )
( )φω
φπ
φπ
+=
+=
+==
nAffnA
fnTAnTxnx
s
ss
ˆcos
2cos
2cos)(][
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
sffwhere πω 2ˆ = is the so-called discrete-
time radian frequency
6
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
Spectrum of Sampled Sinusoids• Assume f = 100Hz, fs = 300Hz, A = 1 and φ= 0
( )( )300/1002cos][
1002cos)(nnxttx
ππ
==
• From Fourier series, it is known that the spectrum of x(t), i.e. Xk is as follows:
f(Hz)0 100-100
1/21/2
Original sinusoid
Sampled sinusoid
Spectrum of original sinusoid
X-1 = X1 =
7
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
• If x(t) is sampled to x(nTs)
∑
∑−
=
−
−
=
−
=
=
1
0
/2
1
0
/2
0
)(2
)(2 0
N
n
Nknjs
N
n
TknTjs
sPk
enTxN
enTxTTX s
π
π
• From Fourier series, we know that
dtetxT
X TktjTk
00 /200
)(2 π−∫=
8
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
T0
Ts
N is the number of samples in one periodN is the number of samples in one period
Ts N = T0 / Ts= 20
N = T0 / Ts= 5
9
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
( )
( )∑
∑
∑
=
+−−
=
−−
=
−
+=
+=
=
2
0
3/)1(23/)1(2
2
0
3/23/23/2
2
0
3/2
31
31
)3/2cos(32
n
nkjnkj
n
knjnjnj
n
knjPk
ee
eee
enX
ππ
πππ
ππ
10
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
0866.05.0866.05.01
)3/22sin()3/22cos()3/2sin()3/2cos(1
1 3/223/22
0
3/2
=−−+−=
++++=
++=∑=
jjjj
eee jj
n
nj
ππππ
πππ
• Let’s consider a particular k, e.g. k = 0
In fact0
1
0
/2 =∑−
=
N
n
Nmnje π if m is not a multiple of N
11
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
• In general
==∑
−
= NofmultiplemforNotherwise
eN
n
Nmnj 01
0
/2π
since
1
/)3(2
/)2(2
/)(2/)0(2
==
=
=
− NnNj
NnNj
NnNjNnj
e
e
ee
π
π
ππ
12
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
( )
=+=−
=
+= ∑=
+−−
otherwiseofmultiplekif
orofmultiplekif
eeXn
nkjnkjPk
03)1(3)1(1
31 2
0
3/)1(23/)1(2 ππ
Magnitude Spectrum for sampled sinusoid
0
0.2
0.4
0.6
0.8
1
1.2
-8 -6 -4 -2 0 2 4 6 8
k
Ampli
tude
13
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and AliasingMagnitude Spectrum for sampled sinusoid
0
0.2
0.4
0.6
0.8
1
1.2
-8 -6 -4 -2 0 2 4 6 8
k
Ampli
tude
Magnitude Spectrum for original sinusoid
0
0.2
0.4
0.6
0.8
1
1.2
-800 -600 -400 -200 0 200 400 600 800
Frequency (Hz)
Ampli
tude
Spectrum of sampled sinusoid
Spectrum of original sinusoid
Ideal low pass filter
14
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
Sampler Ideal Low Pass Filter
fs = 1/Ts
A/D and D/A conversions
A/D converter
D/A converter
15
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
Magnitude Spectrum for sampled sinusoid
0
0.2
0.4
0.6
0.8
1
1.2
-8 -6 -4 -2 0 2 4 6 8
2 pi k
Ampl
itude
sfkf02ˆ πω =
• Very often the discrete-time signal spectrum is expressed using discrete-time radian frequency
0 2π 4π-2π-4π
16
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
Aliasing• Assume f = 100Hz, fs = 200Hz, A = 1 and φ= 0
Magnitude Spectrum for sampled sinusoid
0
0.5
1
1.5
2
2.5
-6 -4 -2 0 2 4 6
k
Ampli
tude
Ideal low pass filter
sfkf02ˆ πω =
0 2π 4π-2π-4π
17
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
• Assume f = 100Hz, fs = 100Hz, A = 1 and φ= 0Magnitude Spectrum for sampled sinusoid
0
0.5
1
1.5
2
2.5
-5 -4 -3 -2 -1 0 1 2 3 4 5
k
Ampli
tude
sfkf02ˆ πω =
0 2π 4π-2π-4π 6π-6π 8π-8π
Only get a DC when an ideal low-pass filter is used
Only get a DC when an ideal low-pass filter is used
18
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
Ts
Just a DC
100 Hz cosine wavef0 = 100Hz
Samples with fs = 100Hz
19
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
Shannon Sampling Theorem
A continuous-time signal x(t) with frequencies no higher than fmax can be reconstructed exactly from its samples x[n] = x(nTs) if the samples are taken at a rate fs = 1/Ts that is greater than 2fmax
Nyquist FrequencyNyquist Frequency
20
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
Discrete-to-Continuous Conversion
• Achieve by low pass filtering⇒ Smooth out the sharp changes in the signal as
much as possible
The simplest low pass filter is a capacitor, which works like a reservoir to store the voltage of the samples
21
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
x[n] x(t)
)3(]3[)2(]2[)(]1[)(]0[)(
s
ss
TtpxTtpxTtpxtpxtx
−+−+−+=
• Let p(t) =
• Such low pass filter operation can be mathematically expressed as
0 tTs
1
0 1 2 3 n t0 Ts 2Ts 3Ts
rectangular pulse
22
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
• Let p(t) =
0 tTs
1 x[n]
0 1 2 3 nx[0].p(t)
0 tx[1].p(t-Ts)
0 tTs
t
x[2].p(t-2Ts)
0 Ts 2Tsx[3].p(t-3Ts)
0 tTs 2Ts 3Ts
x(t)t0 Ts 2Ts 3Ts
23
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
• In general, if we have N samples,
)(][)(1
0s
N
nnTtpnxtx −= ∑
−
=
))1((]1[))2((]2[
)2(]2[)(]1[)(]0[)(
s
s
ss
TNtpNxTNtpNx
TtpxTtpxtpxtx
−−−+−−−++
−+−+=K
24
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
• Rectangular pulse in general cannot give smooth output
25
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
• Let p(t) =
0 t
1
• Next try triangular pulse
)(][)(1
0s
N
nnTtpnxtx −= ∑
−
=
x[n]0 1 2 3 n
x(t)t0 Ts 2Ts 3Ts
Low Pass Filter
sT− sT
x(t)t0 Ts 2Ts 3Ts
26
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
• Triangular pulse in general gives better but not the best output
27
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
• The best pulse is sinc pulse
( )s
sTtTttp
//sin)(
ππ= )4(]4[)(]0[)( sTtpxtpxtx −+=
Ts 5Ts
28
• Sinc pulse gives the best result• However, the length of a sinc pulse is infinitely long• Cannot be implemented exactly• Low pass filter using sinc pulse is the so-called ideal
low pass filter, it has rectangular bandwidth
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
29
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
ExerciseA signal can be represented by the following formulation
( )[ ] ( )tttx )10000(2cos)2000(2cos410)( ππ+=
• Sketch the two-sided spectrum of this signal• Is that signal periodic? If so, what is the period?• What is the Nyquist sampling frequency of this
signal?
30
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
Solution
0
55
11
10000 120008000-10000-12000 -8000
31
Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering
4. Sampling and Aliasing
The signal is periodic since x(t) can be expressed as a sum of sinusoids with the same fundamental frequency. By Fourier series analysis, we know that the resulted signal is periodic.
The period is in fact the inverse of the fundamental frequency, in this case, it is equal to, i.e. 1/2000 sec
The Nyquist frequency of this signal is 2*fmax = 24,000Hz