Lab 2: Linear Time-Invariant Systems
In this experiment, you will study the output response of linear time-invariant (LTI) systems using MATLAB, and learn how to use MATLAB to implement the convolution sum. You will also investigate 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.
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
to a signal of the form for all
. If a linear system is also time-invariant, then the responses
will become
. The combination of linearity and time-invariance therefore allows a system to be completely described by its impulse response
. The output of the system
is related to the input
through the convolution sum as follows:
Similarly, the output
of a continuous-time LTI system is related to the input
and the impulse response
through the following convolution integral:
The convolution of discrete-time sequences
and
represented mathematically by the expression given in
can be viewed pictorially as the operation of flipping the time axis of the sequence
and shifting it by
samples, then multiplying
by
and summing the resulting product sequence over
. This picture arises from the properties of linearity and time-invariance for discrete-time systems. The signal
can be constructed from a linear superposition of delayed and scaled impulses, i.e.
Since a LTI system can be represented by its response to a single impulse, the output of a LTI system corresponds to the superposition
. Mathematically, this results in the convolution sum. It can also prove that (1) is equivalent to the following equation:
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
and
are finite-length sequences. If
is nonzero on the interval
and
is nonzero only on the interval
, then y[n] can be nonzero only on the interval
This means that conv need only compute y[n] for the
samples on this interval. If x is an
-dimensional vector containing x[n] on the interval
and h is an
-dimensional vector containing h[n] on the interval
, then y = conv(h, x) returns in y the
samples of y[n] on the interval in (5). However, conv does not return the indices of samples of y[n] stored in y, which makes sense because the intervals of x and h are not input to conv.
(a) Consider the finite-length signal,
Analytically determine
, where
denotes the convolution operation.
(b) Compute the nonzero samples of
using conv. Plot your results using stem.
The following code may help you:
nx = 0:5;
%interval of
x = [1 1 1 1 1 1];
%
figure, stem(nx, x)
%plot
y = conv(x, x);
%
ny = 0 : ? ;
% interval of
, you should set a value for “?”
figure, stem(ny, y)
% plot
What is the length of y[n]? Does the plot agree with the signal determined in (a)?
(c) Consider the finite-length signal,
Analytically determine
. Next, using conv to compute
. Plot your results using stem. Is the system causal?
(d) Now consider the signal
, where
. Compute
using conv. Plot your result using stem. How does
compare to the signal
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 of the conv function. For the sequences:
construct vectors h and x with proper indices. Define
and compute y = conv(h,x). Determine the proper time indexing for y and plot the result. The following code may help you.
x = [0, 1, 0, 1, 0];
%
nx = –1 : 3;
% interval of
h = [2, 0, –2];
%
nh = 0 : 2; -1:1
% interval of
y = conv(x, h);
% convolution
ny = ?: ?;
% interval of y, you must assign values to the “?”s
figure, stem(ny, y)
% plot
(f) Verify your result in (e) analytically.
(g) Consider the following signal and impulse response,
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] and x[n]. Store in the vector x the value of x[n] for
and store in the vector h the values of h[n] for
.
Now calculate y = conv(h,x) using MATLAB. Since you have truncated both
and
,argue that only a portion of the output of y will be valid. Specify which values in the output are valid and which are not.
3. 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.
(a) Consider the following three signals:
Define the MATLAB vector x to represent
on the interval
, and the vectors h1 and h2 to represent
and
for
. Also define nx to be an appropriate index vector for x[n] and nh for h1[n] and
. 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.
. (6)
This implies that, if
is the input and
is the impulse response, the output is equivalent to that of an LTI system with impulse response
and input
. 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
. (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.
Verify the distributive property using x, h1 and h2. Compute the sum of the outputs of the two LTI systems with impulse responses
and
when
is the input. Compare this with the output of the LTI system whose impulse response is
when the input is
. Do these two methods of computing the output give the same results?
(d) Convolution also possesses the associative property, i.e.,
(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.
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
, as shown in Fig. 4.Compute w[n] by convolving
and
.
· Compute the output
of the whole system by convolving
with
.
· Find the impulse response
.
· Convolve
with
to get the output
.
Compare
and
. Are they the same?
4. 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 if
is the response to the unit impulse
, then the response of the system
to any
is determined by the convolution sum. An analogous property holds for continuous-time LTI systems.
Consider the systems
System 1:
System 2:
System 3:
(a) Consider these three input signals:
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
x2 = [0 1 0 0 0 0];
% define
x3 = [1 2 0 0 0 0];
% define
h = ?;
% impulse response of
w1 = conv(h, x1);
% response of
w2 = conv(h, x2);
% response of
w3 = conv(h, x3);
% response of
nw = 0 : ?;
% interval of
figure, stem(nw, w1)
% plot
figure, stem(nw, w2)
% plot
figure, stem(nw, w3)
% plot
figure, stem(nw, w1+2*w2)
% plot
(b) Is System 1 linear? Is the system time-invariant?
(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
y1 = cos(x1);
% response of
y2 = cos(x2);
% response of
y3 = cos(x3);
% response of
(d) Repeat (a) for System 3. Is System 3 linear? Is it time-invariant?
_1376831421.unknown
_1376831454.unknown
_1376831470.unknown
_1376831486.unknown
_1376831502.unknown
_1376831510.unknown
_1376831514.unknown
_1376831516.unknown
_1376831518.unknown
_1376831519.unknown
_1376831520.unknown
_1376831517.unknown
_1376831515.unknown
_1376831512.unknown
_1376831513.unknown
_1376831511.unknown
_1376831506.unknown
_1376831508.unknown
_1376831509.unknown
_1376831507.unknown
_1376831504.unknown
_1376831505.unknown
_1376831503.unknown
_1376831494.unknown
_1376831498.unknown
_1376831500.unknown
_1376831501.unknown
_1376831499.unknown
_1376831496.unknown
_1376831497.unknown
_1376831495.unknown
_1376831490.unknown
_1376831492.unknown
_1376831493.unknown
_1376831491.unknown
_1376831488.unknown
_1376831489.unknown
_1376831487.unknown
_1376831478.unknown
_1376831482.unknown
_1376831484.unknown
_1376831485.unknown
_1376831483.unknown
_1376831480.unknown
_1376831481.unknown
_1376831479.unknown
_1376831474.unknown
_1376831476.unknown
_1376831477.unknown
_1376831475.unknown
_1376831472.unknown
_1376831473.unknown
_1376831471.unknown
_1376831462.unknown
_1376831466.unknown
_1376831468.unknown
_1376831469.unknown
_1376831467.unknown
_1376831464.unknown
_1376831465.unknown
_1376831463.unknown
_1376831458.unknown
_1376831460.unknown
_1376831461.unknown
_1376831459.unknown
_1376831456.unknown
_1376831457.unknown
_1376831455.unknown
_1376831437.unknown
_1376831445.unknown
_1376831450.unknown
_1376831452.unknown
_1376831453.unknown
_1376831451.unknown
_1376831447.unknown
_1376831449.unknown
_1376831446.unknown
_1376831441.unknown
_1376831443.unknown
_1376831444.unknown
_1376831442.unknown
_1376831439.unknown
_1376831440.unknown
_1376831438.unknown
_1376831429.unknown
_1376831433.unknown
_1376831435.unknown
_1376831436.unknown
_1376831434.unknown
_1376831431.unknown
_1376831432.unknown
_1376831430.unknown
_1376831425.unknown
_1376831427.unknown
_1376831428.unknown
_1376831426.unknown
_1376831423.unknown
_1376831424.unknown
_1376831422.unknown
_1376831405.unknown
_1376831413.unknown
_1376831417.unknown
_1376831419.unknown
_1376831420.unknown
_1376831418.unknown
_1376831415.unknown
_1376831416.unknown
_1376831414.unknown
_1376831409.unknown
_1376831411.unknown
_1376831412.unknown
_1376831410.unknown
_1376831407.unknown
_1376831408.unknown
_1376831406.unknown
_1376831397.unknown
_1376831401.unknown
_1376831403.unknown
_1376831404.unknown
_1376831402.unknown
_1376831399.unknown
_1376831400.unknown
_1376831398.unknown
_1376831393.unknown
_1376831395.unknown
_1376831396.unknown
_1376831394.unknown
_1376831391.unknown
_1376831392.unknown
_1376831390.unknown
[]
k
hn
k
[]
k
hn
[]
k
hnk
–
[]
hn
[]
yn
[]
xn
[][][](1)
m
ynhnmxm
¥
=-¥
=-
å
()
yt
()
xt
()
ht
()()()(2)
ythtxd
ttt
¥
-¥
=-
ò
[]
hn
[]
xn
(1)
[]
hm
n
[]
hnm
–
[]
xm
m
[]
xn
[][][]
m
xnxmnm
d
¥
=-¥
=-
å
(3)
[]
xn
[][][]
m
ynhmxnm
¥
=-¥
=-
å
(4)
[]
xn
[]
hn
[]
xn
1
xxx
nnnN
££+-
[]
hn
1
hhh
nnnN
££+-
()()2
xhxhxh
nnnnnNN
+££+++-
(5)
1
xh
NN
+-
x
N
1
xxx
nnnN
££+-
h
N
1
hhh
nnnN
££+-
1
xh
NN
+-
{
1,05,
0,.
[]
n
otherwise
xn
££
=
[][]*[]
ynxnxn
=
*
[][]*[]
ynxnxn
=
x
[]
xn
[]
xn
[]
yn
y
[]
yn
{
1,05,
10,.
[]
n
otherwise
hn
££
=
11
[][]*[]
ynxnhn
=
1
[]
yn
22
[][]*[]
ynxnhn
=
21
[][5]
hnhn
=+
2
[]
yn
2
[]
yn
1
[]
yn
[]2[1]2[1]
[][][2],
hnnnand
xnnn
dd
dd
=+–
=+-
[][]*[]
ynxnhn
=
[]
xn
x
[]
hn
h
[]
yn
2
1
[][2][][2]
2
n
hnunandxnun
–
æö
=+=-
ç÷
èø
224
n
££
214
n
-££
[]
hn
[]
xn
{
1,04,
0,
[]
n
otherwise
xn
££
=
1
1,0,
1,1,
[]
3,2,
1,4,
0,
n
n
hn
n
n
otherwise
=
ì
ï
-=
ï
ï
=
=
í
ï
=
ï
ï
î
1
2,1,
5,2,
[]
4,3,
1,4,
0,
n
n
hn
n
n
otherwise
=
ì
ï
=
ï
ï
=
=
í
ï
-=
ï
ï
î
[]
xn
09
n
££
1
[]
hn
2
[]
hn
04
n
££
2
[]
hn
11
[][]*[][]*[]
ynxnhnhnxn
==
[]
xn
1
[]
hn
[]
xn
1
[]
hn
1212
[]*([][])[]*[][]*[]
xnhnhnxnhnxnhn
+=+
1
[]
hn
2
[]
hn
[]
xn
12
[][]
hnhn
+
[]
xn
1212
([]*[])*[][]*([]*[]).
xnhnhnxnhnhn
=
1
[]
hn
[]
xn
1
[]
hn
1
[]
yn
[]
wn
2
[]
hn
12
[][]*[]
hnhnhn
=
[]
xn
[]
hn
2
[]
yn
1
[]
yn
2
[]
yn
[]
hn
[]
n
d
[]
yn
[]
xn
[][][1][2].
wnxnxnxn
=—-
[]cos([]).
ynxn
=
[][].
znnxn
=
1
[][]
xnn
d
=
2
[][1]
xnn
d
=-
3
[][]2[1]
xnnn
dd
=+-
1
[]
xn
2
[]
xn
3
[]
xn
[]
wn
1
[]
xn
2
[]
xn
3
[]
xn
[]
wn
1
[]
wn
2
[]
wn
3
[]
wn
12
[]2*[]
wnwn
+
[]
yn
1
[]
yn
2
[]
yn
3
[]
yn