lecture_note #4

advertisement
SAMPLING
Sampling is the acquisition of a continuous signal at discrete time intervals and is a
fundamental concept in real-time signal processing.
The actual sampling operation can also be defined by the figure below and as can be seen
is a MODULATION process. The carrier signal  T (t ) is a “train of impulses”.
x(t)
xs(t)
 T t  

  t  nT 
n  
The output of the modulator is xs(t) and is given by:

x s t   xt  T t   xt    t  nT 
n  
If we recall that convolution by a shifted impulse is the signal shifted by the same amount
then
x s t  

 xnT  t  nT 
n  
This relation describes the sampling process in the time-domain.
The sampling frequency Fs = 1.0/T
must be selected large enough such that the
sampling process will not result in any loss of spectral information (no-Aliasing).
We will investigate the sampling operation further by taking the Fourier Transform of
xs t  .
The Fourier Transform of the impulse train:
 
 2
F  T t   F    t  nT  
n 
 T

  w  nw 
n  
s
2
 2f s
T
here fs is the sampling frequency in Hz.
where w 
Also we recall that multiplication in time is convolution in frequency domain.
X s w 
1
1 2
X w  F  T t  
2
2 T

 X (w)   w  nw 
n  
s
but we already know that X ( w)   w  ws   X w  ws 

X s w 
1 
 X w  nws 
T n  
………………………… (1)
First let x(t) be band limited in frequency such that X(w) = 0 for w > |wM|.
This we can show as in the diagram below:
X(w)
1
w
-wM
wM
Next assume that the highest frequency in X(w) is less than one-half the sampling
frequency:
w
wM  s
2
From equation (1) we note that the effect of the impulse sampling of x(t) is to replicate
the frequency spectrum of X(w) about the frequencies nws = ± 1, ± 2, ± 3,…….as shown
below:
Xs(w)
1/T
-2ws
-ws
0
ws
2ws
w
Fig. 3.1
For this case we can recover the signal x(t) exactly from its samples x[n] using an ideal
low-pass filter.
We call the recovery of a signal from its samples DATA RECONSTRUCTION.
Now assume the case when the highest frequency in x(t) is greater than ws / 2 . The new
plot will be as shown below;
1/T
-2ws
-ws
0
ws
2ws
Fig. 3.2
For the case in Fig. 3.1 x(t) can be recovered exactly from xs(t) by means of a lowpass
filter with gain T and a cutoff frequency greater than wM and less than (ws – wM).
Below is the block diagram showing the use of the lowpass filter:
w
 T t 
x(t)
xs(t)
xr(t)
h(t)
H(jw)
If we assume that the spectrum of x(t) is as shown below
X(w)
1
w
-wM
wM
and assume that the sampling frequency ws > 2wM then the spectrum of the sampled
signal will be as shown below:
Xs(jw)
1/T
-2ws
-ws
-wM
0
wM
ws
2ws
w
Now if we select the cutoff frequency of the lowpass filter to be between wM and (ws –
wM) the characteristic curve for the filter will be as shown below:
H(jw)
T
w
-wc
wc
The spectrum of the reconstructed signal xr(t) will then be as follows:
Xr(jw)
1
w
-wM
wM
Note that in Fig. 3.2 frequency components overlap in the sampled signal and x(t) can
not be recovered by lowpass filtering. A requirement for sampling is the following:
Sampling frequency must be at least twice as great as the highest
frequency wM in the signal that is sampled.
Now let us consider practical sampling.
A physical signal cannot be bandlimited in frequency . However a physical signal does
exist such that the amplitude of the frequency spectrum above a certain frequency is so
small that it is negligible.
We see that an other requirement for sampling is that:
Frequency spectrum of the signal be insignificant above the frequency
ws
where ws  2f s and f s is the sampling frequency.
2
fs
is called the NYQUIST frequency. This is also known as Shannon’s
2
Sampling Theorem.
Frequency
Sampling With a Zero Order Hold.
Sampling theorem was explained in terms of impulse-train sampling.
However in practice, narrow large-amplitude pulses which approximate impulses are
relatively difficult to generate and transmit.
It is often more convenient to generate the sampled signal in a form known as a zeroorder hold.
This system samples x(t) at a given time instant and holds that value until the next
instant.
x(t)
Zero Order
Hold
xo(t)
The reconstruction of x(t) from the output of a zero-order hold can be achieved by
lowpass filtering. However the required filter no longer has constant gain in the passband.
Let us try to develop this filter characteristic curve.
We note that xo(t) can be generated by impulse train sampling followed by an LTI system
with a rectangular impulse response as shown below:
pt 
x(t)
h0(t)
xp(t)
xo(t)
1
0
x(t)
T
xp(t)
xo(t)
To reconstruct x(t) from xo(t) we consider processing xo(t) with an LTI system with
impulse response xr(t).
pt 
x(t)
H(jw)
h0(t)
xp(t)
xo(t)
r(t)
hr(t)
1
Hr(jw)
0
T
We need to specify Hr(jw) so that r(t) = x(t).
We note that this will only be true if the cascade combination of h0(t) and hr(t) is the ideal
lowpass filter H(jw).
Or similarly
H(jw) = H0(jw).Hr(jw)
But we know that the spectrum of h0(t) is:
H 0  jw  e
 jw
T
2
 2 sin wT / 2 


w


hence it is required that
H r  jw 
jw
T
2
e H ( jw)
2 sin( wT / 2)
w
(2)
for example with cutoff frequency of ws/2 the ideal magnitude and phase for the
reconstruction filter following a zero-order hold is as below:
Hr(jw)
|Hr(jw)|
/2
1
w

ws
2
ws
2
w
 s
2
ws
2
w
-/2
We note that the actual realization of equation (2) is not possible without an
approximation. In fact in many situations the output of the zero-order hold is considered
an adequate approximation to the original signal by itself.
Alternatively in some applications we may wish to perform a smoother
interpolation between sample values.
Two important forms of data reconstruction exist:
1. Interpolation (suitable for data transmission systems)
2. extrapolation (suitable for feedback systems)
Extrapolation is interpolation extended to points outside the convex hull of a dataset.
Interpolation values at a point outside the convex hull of an input dataset is referred to as
an extrapolated value.
Interpolation
Is the fitting of a continuous signal to a set of sample values.
 One simple interpolation procedure is the zero order hold previously discussed.
 An other useful form of interpolation is linear interpolation where adjacent points
are connected by a straight line as seen below:
We have seen before that if the sampling instants are sufficiently close, then the signal is
reconstructed exactly.
i.e. through the use of a lowpass filter exact interpolation can be carried out between the
sample points.
Consider in the time-domain the effect of the lowpass filter
x r (t )  x p (t )  h(t )
or
x r (t ) 

 x(nT )h(t  nT )
n  
For the ideal lowpass filter H(jw), h(t) is as follows
h(t ) 
wcT sin( wc t )
wc t
Interpolation Using Matlab
YI = INTERP1( X,Y,XI)
This matlab command will find YI using values of the underlying function Y.
It carries out interpolation for the points in vector XI.
Vector X specifies the points at which the data Y is given
Interpolation is the same operation as “table lookup”. Described in table look up terms
INTERP1 looks up the elements of XI in X and based upon their locations returns values
YI interpolated within the elements of Y.
YI = INTERP1(X,Y,XI, ‘method’);
Usage:
‘nearest’
‘linear’
‘spline’
‘cubic’
:
:
:
:
nearest neighbor interpolation
linear interpolation
cubic spline interpolation
cubic interpolation
Example:
x = 0:10;
y= sin(x);
xi = 0:0.25:10;
yi = interp1(x,y,xi);
plot(x,y,’o’,xi,yi,’*’)
x=
0
1
2
3
4
5
6
7
8
9
10
>> y
y=
Columns 1 through 10
0
0.8415
Column 11
-0.5440
0.9093
0.1411 -0.7568 -0.9589 -0.2794
0.6570
0.9894
0.4121
>> xi
xi =
Columns 1 through 10
0
0.2500
0.5000
0.7500
1.0000
1.2500
1.5000
1.7500
2.0000
2.2500
Columns 11 through 20
2.5000
2.7500
3.0000 3.2500
3.5000
3.7500
4.0000
4.2500
4.5000
4.7500
6.0000
6.2500
6.5000
6.7500
7.0000
7.2500
8.5000
8.7500
9.0000
9.2500
9.5000
9.7500
Columns 21 through 30
5.0000
5.2500
5.5000 5.7500
Columns 31 through 40
7.5000
7.7500
8.0000 8.2500
Column 41
10.0000
>> yi
yi =
Columns 1 through 10
0
0.2104
0.4207
0.6311
0.8415
0.8584
0.8754
0.8923
0.9093
0.7173
Columns 11 through 20
0.5252
0.3332
0.1411 -0.0834 -0.3078 -0.5323 -0.7568 -0.8073 -0.8579 -0.9084
Columns 21 through 30
-0.9589 -0.7890 -0.6192 -0.4493 -0.2794 -0.0453
0.1888
0.4229
0.6570
0.7401
Columns 31 through 40
0.8232
0.9063
Column 41
-0.5440
>>
0.9894 0.8450
0.7007
0.5564
0.4121
0.1731 -0.0660 -0.3050
Download