LS102_LTIS
-
Upload
bayar-jargal -
Category
Documents
-
view
225 -
download
0
Transcript of LS102_LTIS
-
8/2/2019 LS102_LTIS
1/8
EIE/PolyU/LS102/Jan2008 1
The Hong Kong Polytechnic University
Department of Electronic and Information Engineering
EIE312: Linear Systems
LS102: Linear Time-Invariant Systems
In this experiment, you will study the output response of linear time-invariant (LTI) systems usingMATLAB, and learn how to use MATLAB to implement the convolution sum. You will also
investigate the properties of LTI systems. In addition, you will use the instruments simulated by
LabVIEW to study the convolution of two signals and the properties of LTI systems. The objectives of
this experiment are
(1) to study how to compute the output of LTI systems, and
(2) to study the properties of discrete-time LTI systems.
LabVIEW programs provided: LTI_conv.exe, LTI_system.exe.
1. Introduction to Linear Time-Invariant (LTI) Systems
In discrete time, linearity provides the ability to completely characterize a system in terms of its
response hk[n] to a signal of the form [nk] for all k. If a linear system is also time-invariant, then the
responses hk[n] will become h[nk]. The combination of linearity and time-invariance therefore
allows a system to be completely described by its impulse response h[n]. The output of the systemy[n]
is related to the inputx[n] through the convolution sum as follows:
[ ] [ ] [ ]
=
=m
mxmnhny . (1)
Similarly, the outputy(t) of a continuous-time LTI system is related to the inputx(t) and the impulse
response h(t) through the following convolution integral:
( ) ( ) ( )
= dxthty . (2)
The convolution of discrete-time sequences h[n] and x[n] represented mathematically by the
expression given in (1) can be viewed pictorially as the operation of flipping the time axis of the
sequence h[m] and shifting it by n samples, then multiplying h[nm] by x[m] and summing the
resulting product sequence over m. This picture arises from the properties of linearity and
time-invariance for discrete-time systems. The signal x[n] can be constructed from a linear
superposition of delayed and scaled impulses, i.e.
[ ] [ ] [ ]
==
m
mnmxnx . (3)
Since a LTI system can be represented by its response to a single impulse, the output of a LTI system
corresponds to the superpositionx[n]. Mathematically, this results in the convolution sum. It can also
prove that (1) is equivalent to the following equation:
[ ] [ ] [ ]
=
=m
mnxmhny . (4)
-
8/2/2019 LS102_LTIS
2/8
EIE/PolyU/LS102/Jan2008 2
2. Computing the Output of a LTI System Using MATLAB
In this section, you will learn how to use the MATLAB function conv to compute the output of LTI
systems. The MATLAB function conv computes the convolution sum. Assuming that x[n] and h[n]
are finite-length sequences. Ifx[n] is nonzero on the interval nxnnx+Nx1 and h[n] is nonzero
only on the interval nhnnh+Nh1, theny[n] can be nonzero only on the interval
( ) ( ) 2++++ hxhxhx NNnnnnn . (5)
This means that conv need only compute y[n] for the Nx+Nh1 samples on this interval. Ifx is an
Nx-dimensional vector containingx[n] on the interval nxnnx+Nx1 and h is an Nh-dimensional
vector containing h[n] on the interval nhnnh+Nh1, then y = conv(h, x) returns in y theNx+Nh1
samples ofy[n] on the interval in (5). However, conv does not return the indices of samples ofy[n]
stored in y, which makes sense because the intervals ofx and h are not input to conv.
(a) Consider the finite-length signal,
[ ]
= otherwise.,0
,50,1 n
nx
Analytically determiney[n] =x[n]*x[n], where * denotes the convolution operation.
(b) Compute the nonzero samples ofy[n] = x[n] * x[n] using conv. Plot your results using stem.
The following code may help you:
nx = 0:5; % interval of x
x = [1 1 1 1 1 1]; % x[n]
figure, stem(nx, x) % plot x[n]
y = conv(x, x); % y[n]
ny = 0 : ? ; % interval of y, you should set a value for ?
figure, stem(ny, y) % plot y[n]
What is the length ofy[n]? Does the plot agree with the signal determined in (a)?
(c) Consider the finite-length signal,
[ ]
=otherwise.,0
,50,1
nnnh
Analytically determiney1[n] =x[n] * h1[n]. Next, using conv to computey1[n]. Plot your results
using stem. Is the system causal?
(d)Now consider the signaly2[n] = x[n] * h2[n], where h2[n] = h1[n+5]. Computey2[n] using conv.
Plot your result using stem. How does y2[n] compare to the signaly1[n] derived in (c)? Is this
system causal?
(e) Since the MATLAB function conv does not keep track of the time indices of the sequences that
are convolved, some extra bookkeeping is required to determine the proper indices for the result
-
8/2/2019 LS102_LTIS
3/8
EIE/PolyU/LS102/Jan2008 3
of the conv function. For the sequences:
[ ] [ ] [ ][ ] [ ] [ ],2
and1212
+=
+=
nnnx
nnnh
construct vectors h and x with proper indices. Define y[n] = x[n]*h[n] and compute y =
conv(h,x). Determine the proper time indexing fory and plot the result. The following code may
help you.x = [0, 1, 0, 1, 0]; % x[n]
nx = 1 : 3; % interval of x
h = [2, 0, 2]; % h[n]
nh = 0 : 2; -1:1 % interval of h
y = conv(x, h); % convolution
ny = ?: ?; % interval of y, you must assign values to the ?s
figure, stem(ny, y) % plot y[n]
(f) Verify your result in (e) analytically.
(g) Consider the following signal and impulse response,
[ ] [ ] [ ] [ ].22
1and2
2
=+=
nunxnunh
n
If you wish to compute the convolved output using y = conv(h,x), you must deal appropriately
with the infinite length of both h[n] andx[n]. Store in the vectorx the value ofx[n] for 2 n 24
and store in the vectorh the values ofh[n] for -2 n 14.
Now calculate y = conv(h,x) using MATLAB. Since you have truncated both h[n] and x[n],
argue that only a portion of the output ofy will be valid. Specify which values in the output arevalid and which are not.
3. Output Response of a LTI System Using LabVIEW
In this section, you are provided with two signal generators and one CRO, which are simulated by
LabVIEW. The two signals from the signal generators are convolved, and the resulting waveform is
displayed with the CRO. The block diagram of this system is shown in Fig. 1, and the corresponding
interface developed using LabVIEW is illustrated in Fig. 2.
Fig. 1 Block diagram of the convolution system.
Signal Generator: Signal 1
Convolution CRO
Signal Generator: Signal 2
-
8/2/2019 LS102_LTIS
4/8
EIE/PolyU/LS102/Jan2008 4
Execute the LabVIEW program LTI_conv.exe for this system. Then, the panel shown in Fig. 2 will
appear. You should be able to see that the system is operating, and that a convolution output is being
displayed. If the system is stopped, click Operate in the menu bar, and then select Run. The two
signal generators are placed on the top of the panel, while the convolution output of the two signals is
displayed at the bottom of the panel. You may adjust the output of a signal generator using 8
parameters: signal type, duration, duty cycle, time interval, frequency, amplitude, dc offset, phase shift.
You may adjust these parameters one by one and observe the changes in the signal.
Fig. 2 Interface of the convolution system.
(a) Adjust the time interval and duty cycle of both input signals, and observe the corresponding time
interval of the convolution output. What is the relationship of the time intervals of the output
signal and the 2 inputs?
(b) Select square for both input signals and set the DC offset at 1. Adjust the parameter Time Shift
of the input signals. What is the change in the convolution signal?
4. Properties of Discrete-Time LTI Systems
In this section, you will verify the commutative, associative and distributive properties of convolution
for a specific set of signals. In addition, you will examine the implications of these properties for
series and parallel connections of LTI systems.
-
8/2/2019 LS102_LTIS
5/8
EIE/PolyU/LS102/Jan2008 5
(a) Consider the following three signals:
[ ]
=otherwise,,0
,40,1 nnx [ ]
=
=
=
=
=
otherwise,,0
,4,1
,2,3
,1,1
,0,1
1
n
n
n
n
nh [ ]
=
=
=
=
=
otherwise.,0
,4,1
,3,4
,2,5
,1,2
2
n
n
n
n
nh
Define the MATLAB vectorx to representx[n] on the interval 0 n 9, and the vectors h1 and
h2 to represent h1[n] and h2[n] for 0 n 4. Also define nx to be an appropriate index vector for
x[n] and nh forh1[n] and h2[n]. Make appropriately labeled plots of all the signals using stem.
(b) The commutative property states that the result of a convolution is the same regardless of the
order of the operands, i.e.
[ ] [ ] [ ] [ ] [ ]nxnhnhnxny ** 11 == . (6)
This implies that, ifx[n] is the input and h1[n] is the impulse response, the output is equivalent to
that of an LTI system with impulse response x[n] and input h1[n]. Use conv with h1 and x to
verify this property. Is the output of conv the same regardless of the order of the input
arguments?
(c) Convolution is also distributive. This means that
[ ] [ ] [ ]( ) [ ] [ ] [ ] [ ]nhnxnhnxnhnhnx 2121 *** +=+ . (7)
This implies that the output of two LTI systems connected in parallel is the same as one system
whose impulse response is the sum of the impulse responses of the parallel systems. Figure 3
illustrates this property.
Fig. 3 Distributive property of convolution.
Verify the distributive property using x, h1 and h2. Compute the sum of the outputs of the two
LTI systems with impulse responses h1[n] and h2[n] whenx[n] is the input. Compare this with the
output of the LTI system whose impulse response is h1[n]+h2[n] when the input isx[n]. Do these
two methods of computing the output give the same results?
(d) Convolution also possesses the associative property, i.e.,
[ ] [ ]( ) [ ] [ ] [ ] [ ]( )nhnhnxnhnhnx 2121 **** = . (8)This property implies that the result of processing a signal with a series of LTI systems is
equivalent to processing the signal with a single LTI system whose impulse response is the
convolution of all the individual impulse responses of the connected systems. Figure 4 illustrates
this property for the case of two LTI systems connected in series.
h1[n]
h2[n]
y[n]x[n] h1[n]+h2[n] y[n]x[n]+
-
8/2/2019 LS102_LTIS
6/8
EIE/PolyU/LS102/Jan2008 6
Fig. 4 Associative property of convolution.
Use the following steps to verify the associative property using x, h1 and h2:
Let w[n] be the output of the LTI system with impulse response h1[n], as shown in Fig. 4.
Compute w[n] by convolvingx[n] and h1[n]. Compute the outputy1[n] of the whole system by convolving w[n] with h2[n].
Find the impulse response h[n] = h1[n] * h2[n].
Convolvex[n] with h[n] to get the outputy2[n].
Comparey1[n] andy2[n]. Are they the same?
5. Linearity and Time-Invariance
In this section, you will become more familiar with the system properties of linearity and
time-invariance. An important property of discrete-time LTI systems is that ifh[n] is the response to
the unit impulse [n], then the response of the system y[n] to any x[n] is determined by theconvolution sum. An analogous property holds for continuous-time LTI systems.
Consider the systems
System 1: w[n] =x[n] x[n1] x[n2].
System 2: y[n] = cos(x[n]).
System 3: z[n] = nx[n].
(a) Consider these three input signals:
x1[n] = [n]
x2[n] = [n1]
x3[n] = [n] + 2[n1]
For System 1, store in w1, w2, and w3 the responses to these three inputs. Use stem to plot the
four functions represented by w1, w2, w3 and w1+2*w2. The following code may help you.
x1 = [1 0 0 0 0 0]; % define x1[n]
x2 = [0 1 0 0 0 0]; % define x2[n]
x3 = [1 2 0 0 0 0]; % define x3[n]
h = ?; % impulse response of w[n]
w1 = conv(h, x1); % response of x1[n]
w2 = conv(h, x2); % response of x2[n]w3 = conv(h, x3); % response of x3[n]
nw = 0 : ?; % interval of w[n]
figure, stem(nw, w1) % plot w1[n]
figure, stem(nw, w2) % plot w2[n]
figure, stem(nw, w3) % plot w3[n]
figure, stem(nw, w1+2*w2) % plot w1[n]+2*w2[n]
(b) Is System 1 linear? Is the system time-invariant?
h1[n] h2[n]x[n] y[n] h1[n] * h2[n]x[n] y[n]
-
8/2/2019 LS102_LTIS
7/8
EIE/PolyU/LS102/Jan2008 7
(c) Repeat (a) for System 2. Is System 2 linear? Is it time-invariant? The following code may help
you.
ny = 0 : 5; % interval of y[n]
y1 = cos(x1); % response of y1[n]
y2 = cos(x2); % response of y2[n]
y3 = cos(x3); % response of y3[n]
(d) Repeat (a) for System 3. Is System 3 linear? Is it time-invariant?
(e) In this part, we will use LabVIEW to study the linearity and time-invariance of linear systems.
Consider the following two signals, one of which is a delayed version of the other:
x1[n] = [n],
x2[n] = [ndelay].
Consider the following three systems once again:
System 1: w[n] =x[n] x[n1] x[n2].
System 2: y[n] = cos(x[n]).
System 3: z[n] = nx[n].
Execute the LabVIEW program LTI_system.exe, and the panel/interface as shown in Fig. 5 will
be displayed. The system should be operating. If it is not operating, click Operate in the menu
bar, and then click Run. LTI_system.exe implements System 1, System 2 and System 3.
Fig. 5 Interface of LTI_system.exe.
-
8/2/2019 LS102_LTIS
8/8
EIE/PolyU/LS102/Jan2008 8
The three systems are implemented in the LabVIEW program. Each system also has a delay
input and a scale input, as shown on the far left in Fig. 5. In addition, there are 4 graphs, 1 stop
button, 3 system buttons, and 3 LEDs in the panel. The four graphs display the signals defined in
Fig. 6. The top-left graph (Graph 1 in Fig. 5) displays the two input signals [n] and [ndelay] in
white and red, respectively. These two input signals are pre-defined in the system, and you can
modify the delay of the second signal with respect to the first one. The top-right graph (Graph 2 inFig. 5) shows the response of the system to the two input signals. The outputs with [n] and
[ndelay] are represented in white and red, respectively. The bottom-left and bottom-right graphs
(Graph 3 and Graph 4 in Fig. 5) display the Output 1 and Output 2 when the signals are scaled in
different ways.
Fig. 6 Block diagram of the LabVIEW application.
(f) Adjust the parameters delay for each system, and observe the top-right graph in the interface.
Which systems are time-invariant? And which are time-varying?
(g) Adjust the parameters scale for each system, and observe the two bottom graphs in the interface.
Which systems are linear? And which are non-linear?
END
x2[n]
x1[n]
x2[n]
x1[n]
scale
+
System
System
System
scale
+
Output 1
Output 2
x2[n]
x1[n]Graph 1 (top-left graph)
Graph 2 (top-right graph)
Graph 3
(bottom-left graph)
Graph 4
(bottom-right graph)
x1[n]
x2[n]
System
System