Professional Documents
Culture Documents
of Analog Signals
Lecture 5
Sampling and reconstruction of analog
signals
Analogy signals can be converted into discrete signals using
sampling and quantization operations: analogy-to-digital
conversion, or ADC
Digital signals can be converted into analog signals using a
reconstruction operation: digital-to-analogy conversion, or DAC
Using Fourier analysis, we can describe the sampling operation
from the frequency-domain view-point, analyze its effects and then
address the reconstruction operation.
We will also assume that the number of quantization levels is
sufficiently large that the effect of quantization on discrete signals
is negligible.
Sampling
Continuous-time Fourier transform and inverse CTFT
+
X a ( j) = xa (t )e jt dt
1 +
a
jt
xa (t ) = X ( j ) e d
2
1. Absolutely integrable
2. Omega is an analogy frequency in radians/sec
Sampling
Sample xa(t) at sampling interval Ts sec apart to obtain the discrete-
time signal x(n)
x(n) = xa (nTs )
1 + 2
j
X (e ) = X a j l
Ts l = Ts Ts
w = Ts
1
Fs = Fs: the sampling frequency, sam/sec
Ts
1 w w
X (e ) = X a j ; <
jw
Ts Ts Ts Ts Ts
Sampling Principle
A band-limited signal xa(t) with bandwidth F0 can be
reconstructed from its sample values x(n)=xa(nTs) if the
sampling frequency Fs=1/Ts is greater than twice the
bandwidth F0 of xa(t) ,
Fs >2 F0.
xG (m) = xa (mt )
0 1+
1000
t = -0.005:Dt:0.005;
xa(t)
0.5
xa = exp(-1000*abs(t));
Xa(jW)*1000
1
W = k*Wmax/K;
0.5
Xa = xa * exp(-j*t'*W) * Dt; 0
-2 -1 . 5 -1 -0 . 5 0 0.5 1 1.5 2
F re q u e n c y in K H z
Xa = real(Xa);
Xa = [fliplr(Xa), Xa(2:501)];
To reduce the number of computation
subplot(1,1,1)
we compute Xa(j) over [0,4000] rad/sec
subplot(2,1,1);plot(t*1000,xa); then duplicate it over [-4000,0] for plotting
xlabel('t in msec.'); ylabel('xa(t)')
purpose
title('Analog Signal')
subplot(2,1,2);plot(W/(2*pi*1000),Xa*1000);
xa(t)
xa = exp(-1000*abs(t)); 0.5
% Discrete-time Signal
Ts = 0.0002; n = -25:1:25;
x = exp(-1000*abs(n*Ts));
0
% Discrete-time Fourier transform -5 -4 -3 -2 -1 0 1 2 3 4 5
K = 500; k = 0:1:K; t in msec.
w = pi*k/K; Discrete-time Fourier Transform
10
X = x * exp(-j*n'*w);
X = real(X);
w = [-fliplr(w), w(2:K+1)];
X = [fliplr(X), X(2:K+1)]; X(w)
5
subplot(1,1,1)
subplot(2,1,1);plot(t*1000,xa);
xlabel('t in msec.'); ylabel('xa(t)') 0
title('Discrete Signal'); hold on -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Frequency in pi units
stem(n*Ts*1000,x); hold off
subplot(2,1,2);plot(w/pi,X);
xlabel('Frequency in pi units'); ylabel('X(w)')
title('Discrete-time Fourier Transform')
Example 2b
Sample xa(t) in example 1 at Fs = 1000 sam/sec to obtain x1(n)
Nyquist rate is 4000 sam/sec. Fs = 1000 < 4000
Some aliasing Discrete Signal
1
% Analog Signal
Dt = 0.00005;
xa(t)
t = -0.005:Dt:0.005; 0.5
xa = exp(-1000*abs(t));
% Discrete-time Signal
Ts = 0.001; n = -5:1:5; 0
x = exp(-1000*abs(n*Ts)); -5 -4 -3 -2 -1 0 1 2 3 4 5
% Discrete-time Fourier transform t in msec.
Discrete-time Fourier Transform
K = 500; k = 0:1:K; 3
w = pi*k/K;
X = x * exp(-j*n'*w);
2
X = real(X);
w = [-fliplr(w), w(2:K+1)]; X(w)
X = [fliplr(X), X(2:K+1)]; 1
subplot(1,1,1)
subplot(2,1,1);plot(t*1000,xa); 0
xlabel('t in msec.'); ylabel('xa(t)') -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Frequency in pi units
title('Discrete Signal'); hold on
stem(n*Ts*1000,x); hold off
subplot(2,1,2);plot(w/pi,X);
xlabel('Frequency in pi units'); ylabel('X(w)') Shape of X(ej) is different from Xa(j)
title('Discrete-time Fourier Transform')
Result of adding overlapping replicas
Reconstruction
sinc(x) = sin(x)/x
Lowpass filter band-limited to the [-Fs/2,Fs/2] band
The ideal interpolation is not practically feasible because the entire
system is noncausal and hence not realizable.
Reconstruction of band-limited signal
Practical D/A converters
Zero-order-hold (ZOH) interpolation:
In this interpolation a given sample value is held for the
sample interval until the next sample is received.
It can be obtained by filtering the impulse train through an
interpolating filter of the form
0.8
% Plots
0.7
plot(t*1000,xa);
0.6
xlabel('t in msec.'); ylabel('xa(t)')
xa(t)
0.4
error =
0.3
0.2
0.0363
0.1
0
-5 -4 -3 -2 -1 0 1 2 3 4 5
t in m s e c .
Example 4
From the sample x(n) in example 2b, reconstruct xa(t)
x(n) was obtained by sampling xa(t) at Ts = 1/Fs = 0.001 sec.
We will use the grid spacing 0.00005 sec over -0.005 <= t <= 0.005,
which gives x(n) over -5 <= n <= 5
Ts = 0.001; Fs = 1/Ts; n = -5:1:5; nTs = n*Ts;
x = exp(-1000*abs(nTs));
% check R e c o n s t r u c t e d S i g n a l fr o m x 2 ( n ) u s i n g s i n c fu n c t i o n
error = max(abs(xa - exp(-1000*abs(t)))) 1 .2
1
% Plots
plot(t*1000,xa); 0 .8
0 .4
error =
0 .2
0.1852
0
-0 . 2
-5 -4 -3 -2 -1 0 1 2 3 4 5
t in m s e c .
Example 5a
R e c o n s t ru c t e d S ig n a l fro m x 1 (n ) u s in g z e ro -o rd e r-h o ld
1
0.9
Ts = 0.0002; n = -25:1:25; nTs = n*Ts; 0.8
0.7
x = exp(-1000*abs(nTs));
0.6
% Analog Signal reconstruction using stairs
xa(t)
0.5
0.4
stairs(nTs*1000,x);
0.3
xlabel('t in msec.'); ylabel('xa(t)') 0.2
0.1
stem(n*Ts*1000,x); hold off
0
-5 -4 -3 -2 -1 0 1 2 3 4 5
t in m s e c .
Example 5a
Reconstruct signal from the samples in example 2 using FOH
interpolation
It appears to be good but a carefully observation near t=0
reveals that the peak is not carefully reproduce
In general, if the sampling frequency is much higher than the
Nyquist rate, FOH provides acceptable reconstruction
0.8
x = exp(-1000*abs(nTs));
0.7
0.5
plot(nTs*1000,x);
0.4
0.2
0
-5 -4 -3 -2 -1 0 1 2 3 4 5
t in m s e c .
Example 6a
Reconstruct the sample in example 2a using spline function
Maximum error is lower due to nonideal interpolation and the
fact that xa(t) is nonband-limited
The ideal interpolation suffers more from time-limitedness
The plot is excellent
Ts = 0.0002; n = -25:1:25; nTs = n*Ts;
x = exp(-1000*abs(nTs));
R ec ons truc ted S ignal from x 1(n) us ing c ubic s pline func tion
% Analog Signal reconstruction 1
Dt = 0.00005; 0.9
t = -0.005:Dt:0.005;
0.8
xa = spline(nTs,x,t);
0.7
plot(t*1000,xa);
0.6
xa(t)
error = 0.1
0
-5 -4 -3 -2 -1 0 1 2 3 4 5
0.0317 t in m s ec .
Example 6b
Reconstruct the sample in example 2b using spline function
Maximum error is high and cannot be attributed to the
nonideal interpolation or nonband-limitedness of xa(t)
The reconstructed signal differs from the actual one
plot(t*1000,xa); 0.3
xlabel('t in msec.'); ylabel('xa(t)')
stem(n*Ts*1000,x); hold off 0.2
error = 0.1
0
0.1679 -5 -4 -3 -2 -1 0 1 2 3 4 5
t in msec.