Chapter 4.
Sampling of Continuous-Time Signals
40I t d ti 4.0 Introduction 4.1 Periodic Sampling 4.2 Frequency Representation of Sampling 4 3 Reconstruction from Discrete 4.3 Discrete-Time Time Samples 4.4 Changing the Sampling Rate 4.5 Digital Processing of Analog Signals
DSP
4-1
4.0 Introduction
Q estion to answer: ans er how ho to approximate appro imate a contin o s Question continuous (analog) linear system by a digital system? Notations Notations:
Signals: time-domain frequency-domain Systems: time-domain frequency-domain continuous-time discrete-time
xc ( t )
X c ( j )
continuous-time
x[n ]
X ( e j )
discrete-time
hc (t ) H c ( j )
h[n ]
H (e j )
4-2
DSP
4.1 Periodic Sampling
time representation of a A typical method of obtaining a discrete discrete-time continuous-time signal is through periodic sampling.
x[n ] = xc (nT T ), ) - < n < .
T is the sampling period f s = 1 / T is the sampling frequency (samples per second) = 2 / T is the sampling frequency (radians per second)
s
An ideal continuous-to-discrete-time ( (C/D) ) converter
DSP
4-3
Mathematical Representation of Sampling
s (t )
xc ( t )
xs ( t )
Conversion from impulse train to discretetime sequence
x[n] = xc (nT )
s(t ) =
n =
(t nT )
(the periodic impulse train)
xs (t ) = xc (t ) s(t ) = xc (t ) (t nT )
n =
(modulation)
xs ( t ) =
DSP
n =
x (nT ) (t nT )
c
(sifting property)
4-4
Periodic Sampling Examples
DSP
4-5
4.2 Frequency-Domain Representation of Sampling: Time-Domain
We modulate the periodic impulse train with the original continuous-time signals, obtaining
xs (t ) = xc (t ) s (t ) = xc (t ) (t nT )
n =
n =
x (nT ) (t nT )
c
4-6
DSP
Frequency-Domain Representation
Given the Fourier transform of the impulse train as
2 s(t ) = (t nT ) S ( j) = T n =
2 ( k s ) (where s = ) T k =
Since
1 x s ( t ) = x c ( t ) s ( t ) X s ( j ) = X c ( j ) * S ( j ) 2
Then
1 2 X s ( j ) = X c ( j ) * 2 T
k =
( k )
s
1 = X c ( j ( k s )) T k =
DSP 4-7
Observations of Frequency-Domain Representation of Sampling
Thi equation ti provides id th l ti hi b t th i This the relationship between the F Fourier transform of continuous-time signal and discrete-time signal
1 X s ( j) = X c ( j ( k s )) T k =
periodically y repeated p and scaled copies p of the X s ( j) consists of p Fourier transform of The copies of X c ( j) are shifted by integer multiples of the sampling frequency s. All copies of replicated spectrums are superimposed to produce the Fourier transform of the sampled signal signal.
4-8
.) xc (t ), i.e., X c ( j
DSP
DSP
4-9
Sampling Rate and Bandwidth
limited Given the signal of band band-limited
X ( j) = 0, > N
There is no overlap between replicated spectrums, when we have the sampling p g rate as following g
s > 2 N
That means we CAN reconstruct the continuous-time signal with an ideal low-pass filter.
There will be aliasing distortion, or aliasing when s < 2 N
That means we CANNOT reconstruct the continuous-time signal from its samples.
4-10
DSP
How to Reconstruct a Signal?
Ideal low-pass Filtering
DSP
4-11
How to Reconstruct a Signal? (Cont'd)
sampling
Original Signal Ideal low-pass filtering
Discrete-Time Discrete Time Signal
Ideal low-pass p Filtering g
DSP
Reconstructed Signal g
4-12
Sampling and Reconstruction Example
Gi i l Given a signal
xc (t ) = cos 0t
What is the Fourier transform of the given signal? Use the Euler E ler equation eq ation, we e kno know that
According to continuous Fourier transform, we know
1 j0t xc (t ) = cos 0t = e + e j0t 2
x (t ) = e j0t X ( j) = 2 ( 0 )
Therefore, the Fourier transform of the g given signal g is
X c ( j) = ( ( 0 ) + ( + 0 ) )
DSP 4-13
Sampling and Reconstruction Example (No Aliasing)
Original Signal
Sampled Signal
Reconstructed Signal
1 j0t xr (t ) = e + e j0t = cos 0t 2
DSP 4-14
Sampling and Reconstruction Example (With Aliasing)
Original Signal
Sampled Signal
1 j ( s 0 ) t xr ( t ) = e + e j ( s 0 ) t = cos( ( s 0 )t 2
DSP 4-15
Reconstructed Signal
Nyquist Sampling Theorem
S th t xa (t ) X a () is i band-limited b d li it d t Suppose that to a f frequency interval [ N , N ], i.e.,
X () = 0 for N
Then x(t) can be exactly y reconstructed from equidistant q 2 samples xd [n ] = xa ( nTs ) = xa ( 2n / s ), if s = 2 N , Ts where T = 2 / is the sampling period period, s is the
s s
sampling frequency (radians per second), N is referred to as the Nyquist frequency, and 2 N is called the Nyquist rate.
DSP 4-16
How to obtain discrete-time Fourier transform (DTFT)?
Gi th sampled l d signal i l as Given the
xs (t ) =
n =
x (nT ) (t nT )
c
Since we have the following continuous-time Fourier transform (CTFT) pair
(t nT ) e
jnT
Thus we have the continuous-time Fourier transform of the sampled p signal g as
X s ( j) =
DSP
n =
x (nT )e
c
jTn
4-17
How to obtain discrete-time Fourier transform (DTFT)? (Cont'd)
Si l ti hi b t th l d Since we k know th the relationship between the sampled signal xc ( nT ) and the discrete-time sequence x[n ]
x[n ] = xc ( nT T)
We also have the DTFT of
x[n ]
n =
is defined as
X ( e j ) =
By comparing with
jn x [ n ] e
X s ( j) =
DSP
n =
jTn x ( nT ) e c
4-18
How to obtain discrete-time Fourier transform ( (DTFT)? ) (Cont'd) ( )
As we compare the following two equations
X (e ) =
n =
x[n]e
jn
X s ( j) =
= T
n =
T )e x (nT
c
jTn
X s ( j) = X ( e j )
= X ( e jT ).
1 X (e ) = X c T k =
j
2k j T T
( = T )
1 X s ( j) = X c ( j ( k s ) ) T k =
DTFT representation of sampling !
DSP
X (e j ) is simply a frequency-scaled version of X s ( j) with the frequency scaling specified by = T . This scaling is a normalization of the frequency axis so that the frequency = s in X s ( j) is normalized to = 2 for X (e j ) .
4-19
Example 4.1 (Without Aliasing)
time signal xc (t ) = cos( If we sample the continuous continuous-time (4000t ) with sampling period T=1/6000. Continuous-time Fourier transform X s ( j )
Discrete-time Fourier transform
X ( e j )
Problem Analysis
Fourier transform of the original signal 0 = 4000 .
X c ( j) = ( 4000 ) + ( + 4000 )
Sampling frequency s = 2 / T = 12000 . Fourier transforms of the sampled signal
1 X s ( j) = X c ( j ( k s )) T k =
DSP
1 2 X (e ) = X c ( j( k )) T k = T T
j
4-20
Example 4.1 (Cont'd)
( = T )
( / T ) = T ( )
DSP
4-21
Example 4.2 (With Aliasing)
time signal xc (t ) = cos( If we sample the continuous continuous-time (16000t ) with sampling period T=1/6000. Continuous-time Fourier transform X s ( j )
Discrete-time Fourier transform
X ( e j )
Problem Analysis
Fourier transform of the original signal 0 = 16000 .
X c ( j) = ( 16000 ) + ( + 16000 )
Sampling frequency s = 2 / T = 12000 . Fourier transforms of the sampled signal are exactly same as the previous i one, why? h ?
x[n ] = cos(16000n / 6000) = cos(2n + 4000n / 6000) = cos(2n / 3)
DSP 4-22
k=-2 k=0
k=1
k=-1
k=2
k=0
( = T )
( / T ) = T ( )
0 = 16000
DSP 4-23
Example 4.3 (with Aliasing)
time signal If we sample the continuous continuous-time with sampling period T=1/1500. Continuous-time Fourier transform X ( j ) s Discrete-time Fourier transform X ( e j ) Problem Analysis
xc (t ) = cos(4000t )
Fourier transform of the original signal
X c ( j) = ( 4000 ) + ( + 4000 )
Sampling frequency s = 2 / T = 3000 . The discrete-time Fourier transform is the same as previous one. Wh ? Why?
cos(4000n / 1500) = cos(2n + 1000n / 1500) = cos(2n / 3)
DSP 4-24
k=-2 k=0 0
k=1
k=-1
k=2
k=0
( = T )
( / T ) = T ( )
DSP
4-25
4.3 Reconstruction of a Band-limited Signal from Its Samples
met and if the If the conditions of the sampling theorem are met, modulated impulse train is filtered by an appropriate low-pass filter, then the Fourier transform of the filter output p will be identical to the Fourier transform of the original signal. Given a sequence of samples x[n], we form the impulse train
xs ( t ) =
n =
x[n] (t nT )
If the impulse train is the input to an ideal low-pass continuoustime filter with impulse response hr (t )
xr (t ) = xs (t ) * hr (t ) = x[n ] (t nT ) * hr (t ) = x[n ]hr (t nT ) n = n =
DSP
4-26
4.3.1 Ideal Reconstruction System
DSP
4-27
Ideal Reconstruction System (Cont'd)
Frequency Response
Impulse Response
sin(t / T ) t hr (t ) = = sinc t / T T
DSP 4-28
Ideal Reconstruction System (Cont'd)
The ideal reconstruction system is denoted by
xr ( t ) =
n =
x[n]h (t nT )
r
sin(t / T ) t = sinc hr (t ) = t / T T
sin[ (t nT ) / T ] xr (t ) = x[n ] (t nT ) / T n =
If x[n ] = xc ( n nT ) and we have
X c ( j) = 0 for / T
then
x r ( t ) = xc ( t )
DSP 4-29
Ideal Band-limited Interpolation
Th ideal id l l filt i t l t b t th i l The low-pass filter interpolates between the impulses of x[n ] to construct a continuous-time signal
sin[ (t nT ) / T ] xr (t ) = x[n ] (t nT ) / T n =
If there is no aliasing, the ideal low-pass filter interpolates correct reconstruction between the samples. However, the ideal low-pass p filter has infinite length g which is not realizable in practice. Finite length low-pass filtering will result in some reconstruction error.
DSP 4-30
Ideal Band-limited Interpolation (Cont'd)
Original continuous continuous-time time signal
Sampled signal
Reconstructed signal
DSP
4-31
Ideal D/C Converter
DSP
4-32
Ideal D/C Converter (Cont'd)
The properties of the ideal D/C converter are most easily seen in the frequency-domain. sin[ [ (t nT ) / T ] xr (t ) = x[n ] xr (t ) = x[n ]hr (t nT T) (t nT ) / T n = n =
X r ( j) =
n =
jTn x [ n ] H ( j ) e . r
Linearity of continuous-time Fourier transform Time shifting leads to an exponential factor in the Fourier transform Discrete-time Fourier Transform (DTFT) of x[n]
4-33
X r ( j) = H r ( j) X (e
DSP
jT
).
Can you get the original signal back?
lo pass filter selects the base period of the res lting The ideal low-pass resulting periodic Fourier transform X ( e jT ) and compensates for the 1/T scaling inherent in sampling sampling. If the sequence x[n] has been obtained by sampling a bandg at the Nyquist yq rate or higher, g , the reconstructed limited signal signal will be equal to the original band-limited signal. If there is aliasing g during g the sampling, p g the reconstructed signal g will be distorted, see Examples 4.2 and 4.3. In any case, the output of the ideal D/C converter is always band-limited to at most the cut-off frequency of the low-pass filter, which is taken to one-half the sampling frequency.
DSP 4-34
4.3.2 Zero-order Hold D/A Conversion
approximated digitally only if the An analog system is well well-approximated digital output is carefully transformed into analog form.
yd [n ]
d (e j )
g a (t )
a ()
ya ( t )
Comments:
j C Compensation ti with ith either ith d ( e ) or a () - not tb both th. The D/A block g a (t ) is not filtering - it is weighting.
No compensation is needed if
g a (t )
is the ideal reconstructor reconstructor.
4-35
DSP
Impulse Response of Zero-order Hold
This is what is usually done in practice practice, here
where
ya (t ) =
d
n =
x [n ]g
d
g a (t )
d
(t nTs )
1 0
It holdsy
[n ] at a constant level over each sampling period.
Ts
yd [n ]
1
ZOH Z.O.H
ya ( t )
1
-3
DSP
-2 -1
-3
-2 -1
n
4-36
Note: Z.O.H. introduces high frequencies, see sharp edges.
Frequency Response of ZOH
Frequency response of ZOH is a sinc function function.
sin(Ts / 2) jTs / 2 Ga ( j) = e ( / 2)
The high frequencies in the reconstructed signal (sharp steps) are introduced from side-lobes as follows.
Ga ( )
Ideal Z.O.H
DSP
Frequency response of Z.O.H
2 Ts
Ts
Ts
2 Ts
4-37
Compensation of ZOH
The phase response of ZOH corresponds to an advance time shit of T/2 which cannot be compensated and usually neglected. The magnitude g response can be compensated as follows.
(Ts / 2) ; a () = sin( i (Ts / 2) 0;
<
a ()
1
Ts else
2 2 Ts Ts Ts Ts Ideal compensation reconstruction filter
DSP 4-38
Physical Configuration for ZOH D/A Conversion
The D/A converter followed by an ideal compensated reconstruction filter is shown as follows.
DSP
4-39
4.4 Changing the Sampling Rate
necessar to change the sampling rate of a discrete It is often necessary discretetime signal, i.e., to obtain a new discrete-time representation of the underlying continuous-time continuous time signals signals.
x[n ] = xc ( nT ) and x ' [n ] = xc ( nT ' ) where T T '
It is of interest to consider methods of changing the sampling rate that involve discrete-time operations.
x[n ] x ' [n ]
DSP 4-40
Sampling Rate Change Examples (Down-sampling)
What happened during down sampling? down-sampling?
DSP 4-41
4.4.1 Sampling Rate Reduction by an Integer Factor (Down-sampling)
The sampling rate of a sequence can be reduced by "sampling it" by defining a new sequence
xd [n ] = x[nM ] = xc ( nMT ).
DSP
4-42
Frequency Representation of Down-Sampling [W-D]
First recall that the DTFT of x[n ] = xc ( nT T ) is
1 X (e ) = X c T k =
j
2k j T T
Similarly the DTFT of Similarly,
xd [n ] = x[nM ] = xc ( nMT ) is
Xc r =
1 X d (e ) = MT
j
2r j MT MT
Questions: what is the relationship Q p between them?
X ( e j ) X d ( e j )
DSP 4-43
Frequency Representation of Down-Sampling (Cont'd)
We can represent
1 X d (e ) = MT
j
Xc r =
2r j MT MT
r is still an interger ranging from -inf and inf
( r = i + kM )
< k < , 0 i M 1
1 j X d (e ) = M
M 1
1 2 ( kM + i ) X c j MT i =0 T k = MT
M 1
1 j X d (e ) = M
DSP
1 2k 2i X c j T MT i =0 T k = MT
4-44
Frequency Representation of Down-Sampling (Cont'd)
We then have
1 j X d (e ) = M
j j
M 1
1 Xc i =0 T k =
2i 2k j T MT
We know that
1 2 k k 1 2 = X c j X((e e )) = X (DTFT from CTFT) T kk= T T T = T
1 j ( 2 i ) / M ) = T X c X (e k =
2i 2k j T MT
j ( 2 r ) / M
Therefore, we have
1 j X d (e ) = M
DSP
M 1 r =0
X (e
)
4-45
Frequency Representation of Down-Sampling (Cont'd)
We can have the following conclusions by observing
M 1 r =0 j ( 2 r ) / M ( ) X e
1 j X d (e ) = M
There is a strong analogy between X d ( e j ) and X ( e j ). ) X d ( e j ) can be composed of M copies of the periodic Fourier transform X ( e j ) , frequency scaled by M and shifted by integer multiples lti l of f 2.
X d ( e j ) is periodic with period 2.
Aliasing can be avoided if
X ( e j ) = 0, N (band - limited) (narrow - banded) ( b d d) 2 / M 2N
DSP 4-46
2 / T = 4 N s = 4 N
N = N T = / 2
-4
DSP
4-47
Frequency Representation of Down-Sampling: Example
DSP
4-48
Down-sampling after Pre-filtering
sampling we need to reduce If aliasing occurs during down down-sampling, the band-width of signal x[n] prior to down-sampling. Signal x[n] will be pre-filtered pre filtered by an ideal low-pass low pass filter with cut-off frequency /M.
DSP
4-49
Down-sampling after Pre-filtering (Example)
hlp [n ] =
sin c n sin( (n / M ) = n n
DSP
4-50
4.4.2 Increasing the Sampling Rate by an Integer Factor
Consider a signal x[n] whose sampling rate we wish to increase by a factor of L (up-sampling).
] n = kL and k Z x[n / L], xe [ n ] = 0, otherwise
For example,
xe [n ] = (1 0 2 0 3 0 4 0 5 0) ( n = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and L = 2)
Or equivalently,
xe [ n ] =
DSP
k =
x[n ] = (1 2 3 4 5) ( n = 0, , 1, , 2, , 3, , 4) )
x[k ] [n kL]
(not LTI convolution)
4-51
Sampling Rate Change Examples (Up-sampling) Demo
> 8 kHz) Speech (4kHz ->
DSP
4-52
Frequency Representation of Up-Sampling
Th Fourier F i transform t f f the th up-sampled l d signal i li The (DTFT) of is
jn j X e ( e ) = ( x[k ] [n kL ]) e n = k =
k =
jkL jL x [ k ] e = X ( e )
We can see the Fourier transform of the output of the expander is a frequency-scaled frequency scaled version of the Fourier transform of the input, i.e, is replaced by L.
DSP
4-53
Frequency Representation of Up-Sampling (Example)
DSP
4-54
General System for Up-sampling
To fill missing samples sampling is samples, the operation of up up-sampling therefore considered to be synonymous with interpolation.
sin c n sin n / L hlp [n ] = L = n / L n
G i Gain
DSP 4-55
Ideal Low-pass Filtering after Up-sampling
As in the case of D/C converter converter, it is possible to obtain an interpolation formula with an ideal low-pass filter as
sin[ ( n kL) / L] xi [n ] = x[k ]hlp [n kL] = x[k ] (n kL) / L k = k =
The impulse response of the low pass filter has properties
hi [0] = 1 sin(n / L) hi [n ] = hi [n ] = 0 , n = L,2 L,3L,.... n / L
Thus for the ideal low-pass interpolation filter, we have
xi [n ] = x[n / L], ] n = L,2 L,3L,...
DSP 4-56
Frequency Representation of Up-Sampling and Ideal Low-pass Filtering (Example)
DSP
4-57
Linear Interpolation after Up-sampling
Linear interpolation can be accomplished by the
1 n / L, n L hlin = otherwise 0,
DSP
4-58
Linear Interpolation after Up-sampling (Example)
1 sin(L / 2) H lin ( e j ) = L sin( / 2)
DSP
4-59
Linear Interpolation after Up-sampling (Example, Cont'd)
Please note that
hi [0] = 1 1 n / L, n L hlin li [ n ] = hi [n ] = 0 , n = L,2 L,3L,.... otherwise 0,
So that
xi [n ] =
k =
x[k ]h
lin
[n kL]
xlin [n ] = x[n / L], n = L,2 L,3L, ,...
The amount of distortion in the intervening samples can be gauged by comparing the frequency response of the linear interpolator with that of the ideal low-pass interpolator, as
1 sin(L / 2) H lin li ( e ) = L sin( / 2 )
j
DSP
4-60
4.5 Digital Processing of Analog Signals
There are only two approaches to avoiding aliasing
Sample at a faster rate - perhaps not possible (why?). Use an anti-aliasing g filter.
DSP
4-61
How to reduce aliasing?
anti aliasing filter is a low-pass low pass analog filter (LPF) that An anti-aliasing is applied to the continuous signal prior to sampling.
The idea is sample: p remove the high g frequencies q . The ideal frequency response of the anti-aliasing filter is an ideal low-pass filter as > / 2 ,
s
where the cut off
1; F = 0;
1 c c < s = Ts 2 > c
Even the LPF destroys information, it is better than the aliasing effect effect. Ideal sampler
xa (t )
DSP
Fa ()
Anti-aliasing filter (low-pass)
xd (n)
Ts
4-62
Anti-aliasing: Formulation
aliasing the sampled signal becomes With anti anti-aliasing,
xd [n ] = xa (nT Ts ) * f a ( nT Ts )
1 X d (e ) = Ts
j
2m 2m X Fa a T T m = s s
The repeated spectra X a () Fa () will not fold f or overlap. If Fa () is an ideal LPF with cutoff c , then
1 X d ( e j ) = Ts X a (); 2m where X a = Xa T m = s 0;
c > c
Usually, an ideal LPF cannot be realized and must be approximated.
DSP 4-63
Anti-aliasing: Example-1
X a ()
Analog Signal Spectrum
X a () Fa ()
Anti-aliased Spectrum
Sampled Signal Spectrum (without aliasing)
c
c < s / 2
X d (e j )
2
DSP
cTs
cTs
2
4-64
Anti-aliasing: Example-2
Original image
Down-sampling with aliasing
Down-sampling with anti-aliasing
DSP
4-65
Anti-aliasing: Digital Filter Output
R ll th ll system t fi t t Recall the overall of interest:
xd [ n ]
xa ( t )
yd [n ]
H d ( e j )
ya ( t )
H a ()
The response p g filter H d ( e j ) Yd ( e j ) of the digital
1 Yd ( e ) = Ts
j
2m j X H ( e ) a d m = Ts
without anti-aliasing
1 Yd ( e ) = Ts
j
2m 2m j X F H ( e ) a a d m = Ts Ts
with anti-aliasing
DSP
4-66