Chapter 4
Chapter 4
Chapter 4
Sampling of
Continuous-Time Signals
4.0 Introduction
4.1 Periodic Sampling
4.2 Frequency Representation of Sampling
4 3 Reconstruction from Discrete-Time
4.3 Discrete Time Samples
4.4 Changing the Sampling Rate
4.5 Digital Processing of Analog Signals
time-domain xc (t ) x[n ]
frequency-domain Xc( j ) X (e j )
Systems: continuous-time discrete-time
time-domain h[n ]
hc (t )
frequency-domain
Hc ( j ) H (e j )
Digital Signal Processing 4-2
4.1 Periodic Sampling
A typical method of obtaining a discrete-time representation of a
continuous-time signal is through periodic sampling.
s(t )
Conversion
from impulse
xc (t ) train to discrete- x[n] = xc (nT )
xs (t ) time sequence
x s ( t ) = xc ( t ) s ( t ) = xc ( t ) (t nT ) (modulation)
n=
xs (t ) = xc ( nT ) (t nT ) (sifting property)
n=
xs (t ) = xc (t ) s (t )
= xc (t ) (t nT )
n=
= xc (nT ) (t nT )
n=
Since
1
x s ( t ) = xc ( t ) s ( t ) Xs( j ) = X c ( j ) * S( j )
2
Then
1 2
Xs( j ) = Xc( j )* ( k s )
2 T k=
1
= X c ( j( k s ))
T k=
Digital Signal Processing 4-7
Observations of Frequency-Domain
Representation of Sampling
This equation provides the relationship between the Fourier
transform of continuous-time signal and discrete-time signal
1
Xs( j ) = X c ( j( k s ))
T k=
X ( j ) = 0, > N
sampling
Ideal low-pass
filtering
x (t ) = e j 0t
X( j ) = 2 ( 0 )
Therefore, the Fourier transform of the given signal is
Xc( j ) = ( ( 0 )+ ( + 0 ))
Digital Signal Processing 4-14
Sampling and Reconstruction Example
(No Aliasing)
Original Signal
Sampled Signal
Reconstructed Signal
2
(
1 j
xr ( t ) = e 0t
+e j 0t
) = cos 0 t
Digital Signal Processing 4-15
Sampling and Reconstruction Example
(With Aliasing)
Original Signal
Sampled Signal
Reconstructed Signal
1 j(
xr ( t ) = e
2
( s 0 )t
+e j( s 0 )t
) = cos( s 0 )t
Digital Signal Processing 4-16
Nyquist Sampling Theorem
Suppose that xa (t ) X a ( ) is band-limited to a 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 ( 2 n / s ), if s = 2 N ,
Ts
where T = 2 / is the sampling 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.
xs ( t ) = xc ( nT ) (t nT )
n=
Since we have the following continuous-time Fourier
transform (CTFT) pair
(t nT ) e j nT
n=
X (e j ) = x[n ]e j n
n=
By comparing with
Xs( j ) = xc ( nT )e j Tn
n=
X (e j ) = x[n ]e j n
Xs( j ) = xc ( nT )e j Tn
n= n=
1
X s ( j ) = X (e j ) = X ( e j T ). Xs( j ) = X c ( j( k s ))
= T T k=
Continuous-time Fourier
1 transform (CTFT) of the
X (e j T
)= X c ( j( k s )) sampled signal xs (t ) .
T k=
( = T) What you can see?
1 2 k Discrete-time Fourier
X (e ) =
j
Xc j
T k= T T transform (DTFT) of the
discrete-time signal x[n ] .
Digital Signal Processing 4-20
Example 4.1 (Without Aliasing)
If we sample the continuous-time signal xc (t ) = cos(4000 t )
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 .
Xc( j ) = ( 4000 ) + ( + 4000 )
s = 2 / T = 12000 .
Sampling frequency
Fourier transforms of the sampled signal
1 1 2
Xs( j ) = X c ( j( k s )) X (e j ) = X c ( j( k ))
T k= T k= T T
( = T) ( /T) = T ( )
s = 2 / T = 12000 .
Sampling frequency
Fourier transforms of the sampled signal are exactly same as the
previous one, why?
( = T) ( /T) = T ( )
0 = 16000
( = T) ( /T) = T ( )
xs ( t ) = x[n ] (t nT )
n=
If the impulse train is the input to an ideal low-pass continuous-
time filter with impulse response hr (t )
sin( t / T ) t
hr (t ) = = sinc
t /T T
sin[ (t nT ) / T ]
xr ( t ) = x[n ]
n= (t nT ) / T
Original continuous
continuous-time
time signal
Sampled signal
Reconstructed signal
Linearity of continuous-time
Xr( j ) = x[n ]H r ( j )e j Tn
. Fourier transform
X r ( j ) = H r ( j ) X (e j T
). Discrete-time Fourier
Transform (DTFT) of x[n]
sin[ (t nT ) / T ]
Yr (t ) = y[n]
n= (t nT ) / T
Yr ( j ) = H r ( j )Y (e j T
)
TY (e j T ),
= T
0, otherwise
Y ( e ) = H ( e ) X (e )
j j j
Yr ( j ) = H r ( j ) H (e j T
) X (e j T
)
= T
1 2 k
Yr ( j ) = H r ( j ) H (e j T
) Xc j
T k= T T
H (e j T
)Xc( j )
Yr ( j ) = T
0,
T
FGHI GM @KNOGP @KKQC STU JCDKD WK =AGXH SYZ BCDRKO JCDKD SPXK
.AR? SH FGKM [R\ BTML@ GM F] @^RH SDPGZ@\ _DGO BZ `DL
Digital Signal Processing 4-39
:A@LA SbCDM =HGc RA BM JCDKD FKL LTI @GC\@
.A?GM LTI AKGM BCDDE FGHI JCDKD
.A?GM ARAdH APGM AKGM eAR@R =GPbKD
kRfUM
H (e ) = H c (
j j ), ,
T
BZ eRdP BM T lGUCPL GM
H c ( j ) = 0,
T
BTML@ BCDDE JCDKD BM@m _DGO R BCDRKO JCDKD BM@m _DGO FKM @EL
A?GM @L@n@M @KI
h[n] = Thc (nT )
FGHI JCDKD IL impulse-invariant BUDP WK L@ BCDDE FGHI JCDKD
.JKKRE BCDRKO
Digital Signal Processing 4-42
2 k
H (e ) = j
Hc j
k= T T
H (e ) = H c (
j j )
), ,
T
sin[ (t nT ) / T ]
Yr (t ) = y[n]
n= (t nT ) / T
y[n] = yc (nT )
sin[ (t nT ) / T ] sin[ (t nT ) / T ]
X c (t ) = x[n] Yc (t ) = y[n]
n= (t nT ) / T n= (t nT ) / T
T T
H (e ) = H c ( j
j
)
T
Digital Signal Processing 4-46
oA?GMP pKdf GCqA @EL
x[n] = xc (nT )
x'[n] = xc (nT ' )
T T'
1 2 r
X d (e ) = j
Xc j
T ' r= T' T'
T ' = MT
1 2 r
X d (e ) = j
Xc j
MT r= MT MT
r = i + kM
k
0 i M 1
Digital Signal Processing 4-52
1 M 1
$1 2 k 2 i !
X d (e ) =
j
" Xc j
M i =0 # T k = MT T MT
j( 2 i) 1 2 i 2 k
X (e M
)= Xc j
T k= MT T
M 1
1 j( 2 i )
X d (e ) =
j
X (e M M
M i =0
yd [n ] %d ( e j ) g a ((t ) %a ( ) ya (t )
Comments:
Compensation with either %d ( e ) or %a ( ) - not both.
j
yd [n ] Z.O.H ya (t )
1 1
-3 -2 -1 0 1 2 3 n -3 -2 -1 0 1 2 3 n
Note: Z.O.H. introduces high frequencies, see sharp edges.
Digital Signal Processing 4-58
Frequency Response of ZOH
Frequency response of ZOH is a sinc function.
sin( Ts / 2)
Ga ( j ) = e j Ts / 2
( / 2)
The high frequencies in the reconstructed signal (sharp steps)
are introduced from side-lobes as follows.
Ga ( ) Ideal
Z.O.H
2 2
Ts Ts Ts Ts
Frequency response of Z.O.H
Digital Signal Processing 4-59
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 response can be compensated as follows.
( Ts / 2)
; <
%a ( ) = sin(
i ( Ts / 2) Ts %a ( )
0; else 1
2 2
Ts Ts Ts Ts
Ideal compensation reconstruction filter
xd [n ] = x[nM ] = xc ( nMT ).
X (e j ) X d (e j )
Digital Signal Processing 4-65
Frequency Representation of
Down-Sampling (Cont'd)
We can represent
1 2 r
X d (e ) =j
Xc j
MT r= MT MT
( r = i + kM )
1 M 1
$1 2 ( kM + i ) !
X d (e ) =
j
" Xc j
M i =0 # T k= MT MT
1 M 1
$1 2 k 2 i !
X d (e ) =
j
" Xc j
M i =0 # T k= MT T MT
$1 !
X (e ) = "T X c j
j( 2 i) / M 2 i 2 k
# k= MT T
Therefore, we have
X (e )
M 1
1
X d (e ) =
j j( 2 r) / M
M r =0
Digital Signal Processing 4-67
Frequency Representation of
Down-Sampling (Cont'd)
X (e j ( )
M 1
1
X d (e ) =
j 2 r) / M
M r =0
X (e j ) = 0, N (band - limited)
2 /M 2 N (narrow - banded)
Digital Signal Processing 4-68
2 /T = 4 N
s =4 N
N = N T= /2
-4 4
sin n sin( n / M )
hlp [n ] = c
=
n n
X e (e j ) = (x[k ] [n kL]) e j n
n= k=
= x[k ]e j kL
= X (e j L )
k=
sin n sin n / L
hlp [n ] = L ( c
=
n n/L
Gain
1 n / L, n L
hlin =
0, otherwise
2
1 $ sin( L / 2) !
H lin ( e j ) = "
L # sin( / 2)
L # sin( / 2)
Digital Signal Processing 4-82
Changing the sampling rate by a noninteger factor
Time-Domain Characterization
Time-
An up-sampler with an upup--sampling factor L, where L is a
positive integer, develops an output sequence xu [n]
with a sampling rate that is L times larger than that of the
input sequence x[n]
Block-diagram representation
x[n] L xu [n ]
0.5 0.5
Amplitude
0 Amplitude 0
-0.5 -0.5
-1 -1
0 10 20 30 40 50 0 10 20 30 40 50
Time index n
Time index n
Digital Signal Processing 4-86
Up
Up--Sampler
In practice, the zero-valued samples inserted by the up-
sampler are replaced with appropriate nonzero values using
some type of filtering process
Process is called interpolation
x[n] M y[n]
I t Sequence
Input S Output sequence down-sampled
down sampled by 3
1 1
0.5 0.5
Amplitude
Amplitude
0 0
-0.5 -0.5
-1 -1
0 10 20 30 40 50 0 10 20 30 40 50
Time index n Time index n
Digital Signal Processing 4-90
Basic Sampling Rate Alteration Devices
Sampling periods have not been explicitly shown in the
block-diagram representations of the up-sampler and the
down-sampler
This is for simplicity and the fact that the mathematical
theory of multirate systems can be understood without
b i i the
bringing h samplingli period
i d T or the
h sampling
li frequency
f FT
into the picture
x[ n ] = xa ( nT ) M y[ n ] = xa ( nMT )
x[ n ] = xa ( nT
T) L y[n]
[ ]
xa ( nT / L ), n =0, ± L , ±2 L ,…
=
0 otherwise
The up
up--sampler and the down
down--sampler are linear but
time--varying discrete-
time discrete-time systems
We illustrate the time-varying
time varying property of a down-sampler
down sampler
The time-varying property of an up-sampler can be
proved in a similar manner
y[n n0 ] = x[ M (n n0 )]
= x[ Mn Mn0 ] y1[n]
Digital Signal Processing 4-95
Up
Up--Sampler
Frequency
Frequency--Domain Characterization
Consider first a factor-of-2 up-sampler whose input-
output relation in the time-domain is given by
n n
X u ( z) = xu [n] z = x[n / 2] z
n= n=
n even
= x[m] z 2m
= X (z2 )
m=
L
u ( z) =
On the unit circle,Xfor X, (the
z input-output
) relation is
given
i b
by j
z=e
j j L
X u (e ) = X (e )
xu [n] L 1
xu [n]
0.8 0.8
Magnitude
Magnitude
0.6 0.6
0.4 0.4
0.2 0.2
0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
/ /
Frequency
Frequency--Domain Characterization
Applying the z-transform to the input-output relation of a factor-of-M
down-sampler
we get
y[n] = x[Mn]
The expression on the right-hand side cannot be directly expressed
n
in terms of X(z)
Y ( z) = x[Mn] z
n=
n n
Y ( z) = x[Mn] z = xint [Mn] z
n= n=
k/M 1/ M
= xint [k ] z = X int ( z )
k=
Digital Signal Processing 4-104
Down
Down--Sampler
1 M 1 kn
c[n] = WM
M k =0
j2 / M
WM = e
Digital Signal Processing 4-105
Down
Down--Sampler
1 M 1
kn
c[n] = WM
we
eaarrive
e at M k =0
1 M 1
n
X int ( z ) = c[n]x[n] z = WMkn x[n] z n
n= M n= k =0
( )
1 M 1 1 M 1
kn n k
= x[n]WM z = X z WM
M k =0 n = M k =0
Digital Signal Processing 4-106
Down
Down--Sampler
Consider a factor-of-2 down-sampler with an input x[n]
whose spectrum is as shown below
1
Y (e j ) = { X (e j / 2) + X( ej / 2 )}
Digital Signal Processing 2 4-107
Down
Down--Sampler
Now X ( e j / 2 ) = X (e j ( implying
2 ) / 2 )that the
second term in the previous
j / 2 equation is
X (firste term )
simply obtained by shifting the to the
right by an amount 2 as shown below
X (e j /2)
X (e j )
Note:
ote iss indeed
deed pe
periodic
od c with
t a pe
period
od 2 , e
even
e
though the stretched version of is periodic with a
j
period 4 X (e ) = 0 for /2
Y (e j )
X (e j )
is a sum of
M M1uniformly shifted and stretched
versionsYof(e j ) =and1 scaled by aj ( factor
2 kof) /1/M
M)
X (e
M k =0
Y (e j )
X (e j )
X ( e j ) = 0 for /M
as shown below for M = 2
X (e j ) = 0 for /2
0.8 0.4
Magnitude
Magnitude
0.6 0.3
0.4 0.2
0.2 0.1
0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
/ /
0.8 0.4
Magnitude
Magnitude
0.6 0.3
Effect
0.4 of aliasing can be clearly0.2seen
0.2 0.1
0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
/ /
x[n ] M L y1 [ n ]
x[n ] L M y2 [ n]
y1[n] = y2[n]
Cascade equivalence #1
#1
x[n ] M H (z ) y1 [ n ]
* x[n ] H (z M ) M y1 [ n ]
Cascade equivalence #2
x[n ] L H (z L ) y2 [ n]
* x[n ] H (z ) L y2 [ n]
Digital Signal Processing 4-118
Filters in Sampling Rate Alteration
Systems
From the sampling theorem it is known that a sampling
rate of a critically sampled discrete-time signal with a
spectrum occupying the full Nyquist range cannot be
reduced any further since such a reduction will introduce
aliasing
Hence the bandwidth
Hence, band idth of a critically
criticall sampled signal must
m st
be reduced by lowpass filtering before its sampling rate is
reduced by a down-sampler
j 1 j j2 k
X (e )= Xa
To k = To
To
Digital Signal Processing 4-123
Interpolation Filter Specifications
j 1 j j2 k L j j2 k
Y (e )= Xa = Xa
T k= T To k = To / L
Digital Signal Processing 4-124
Interpolation Filter Specifications
On the other hand, if we pass x[n] through a factor-of-L
up-sampler generating , the relation between the
Fourier transforms of x[n] and xuby
are given [n]
It therefore
th f xllu [n
[ ] that
ffollows th t if i passed
is d through
th h an
ideal lowpass filter H(z) with a cutoff at /L and a gain of
j j L
X
L, the output of the ( e ) = X ( e ) y[n]
u filter will be precisely
xu [n]
s = /L
p s
j L, c/L
H (e )=
0, /L
Digital Signal Processing 4-127
Decimation Filter Specifications
In a similar manner, we can develop the specifications for
the lowpass decimation filter that are given by
j 1, c /M
H (e )=
0, /M
H d (z) M L H u (z)
L H u (z) H d (z) M
s = min ,
L M
L H (z) M
N 1
v[n] = h[m] x[n m]
Digital Signal Processing m =0 4-134
Computational Requirements
v[n ] y[n ]
x[n ] H (z) M
N 1
v[n] = h[m] x[n m]
m =0
where
ee V ( z) P( z )
= H ( z) =
X ( z) D( z )
K
n
P( z ) = pn z
n =0
K
n
D( z ) = 1 + dn z
Digital Signal Processing n =1 4-137
Computational Requirements
Its direct form implementation is given by
w[n] = d1w[n 1] d 2 w[n 2]
d K w[n K ] + x[n]
1 1
Amplitude
Amplitude
0 0
-1 -1
-2 -2
0 20
40 60 80 100 0 10 20 30 40 50
Time index n Time index n
Digital Signal Processing 4-142
Sampling Rate Alteration Using MATLAB
The function interp can be employed to increase the
sampling rate of an input signal x by an integer factor L
generating the output vector y
The lowpass filter designed by the M-file is a symmetric FIR
filter
1 1
Amplitude
Amplitude
0 0
-1 -1
-2 -2
0 10 20 30 40 50 0 20 40 60 80 100
Time index n Time index n
Digital Signal Processing 4-145
Sampling Rate Alteration Using
MATLAB
The function resample can be employed to increase the
sampling rate of an input vector x by a ratio of two
positive integers, L/M, generating an output vector y
The M-file employs a lowpass FIR filter designed using
fir1 with a Kaiser window
The fractional interpolation of a sequence can be
obtained using Program 10_7 which employs the function
resample
1 1
Amplitude
Amplitude
0 0
-1 -1
-2 -2
010 20 30 0 10 20 30 40 50
Time index n Time index n
Digital Signal Processing 4-147
Digital Processing of Analog Signals
xa (t ) Fa ( ) xd (n)
Anti-aliasing filter
(low-pass)
Ts
Digital Signal Processing 4-149
Anti-aliasing: Formulation
1 2 m 2 m
xd [n ] = xa (nTs ) * f a (nTs ) X d (e j ) = Xa Fa
Ts m= Ts Ts
1 2 m X a ( ); c
X d (e ) =
j
Xa where X a =
Ts m= Ts 0; > c
0
X a ( ) Fa ( )
Anti-aliased Spectrum
0
c
c
Sampled Signal Spectrum X d (e j )
(without aliasing) c < s /2
0
cTs T
2 c s
2
Digital Signal Processing 4-151
Anti-aliasing: Example-2
Ha ( )
1 2 m 2 m
Yd ( e j ) = Xa Fa H d (e j ) with anti-aliasing
Ts m= Ts Ts
Digital Signal Processing 4-153