Vous êtes sur la page 1sur 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 using
MATLAB, 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 h
k
[n] to a signal of the form [nk] for all k. If a linear system is also time-invariant, then the
responses h
k
[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 system y[n]
is related to the input x[n] through the convolution sum as follows:
| | | | | |

=
=
m
m x m n h n y . (1)
Similarly, the output y(t) of a continuous-time LTI system is related to the input x(t) and the impulse
response h(t) through the following convolution integral:
( ) ( ) ( )


= d x t h t y . (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
m n m x n x . (3)
Since a LTI system can be represented by its response to a single impulse, the output of a LTI system
corresponds to the superposition x[n]. Mathematically, this results in the convolution sum. It can also
prove that (1) is equivalent to the following equation:
| | | | | |

=
=
m
m n x m h n y . (4)
www.zaluu.com
www.zaluu.com
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. If x[n] is nonzero on the interval n
x
n n
x
+N
x
1 and h[n] is nonzero
only on the interval n
h
n n
h
+N
h
1, then y[n] can be nonzero only on the interval
( ) ( ) 2 + + + +
h x h x h x
N N n n n n n . (5)
This means that conv need only compute y[n] for the N
x
+N
h
1 samples on this interval. If x is an
N
x
-dimensional vector containing x[n] on the interval n
x
n n
x
+N
x
1 and h is an N
h
-dimensional
vector containing h[n] on the interval n
h
n n
h
+N
h
1, then y = conv(h, x) returns in y the N
x
+N
h
1
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,
| |


=
otherwise. , 0
, 5 0 , 1 n
n x
Analytically determine y[n] = x[n]*x[n], where * denotes the convolution operation.

(b) Compute the nonzero samples of y[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 of y[n]? Does the plot agree with the signal determined in (a)?

(c) Consider the finite-length signal,
| |


=
otherwise. , 0
, 5 0 ,
1
n n
n h
Analytically determine y
1
[n] = x[n] * h
1
[n]. Next, using conv to compute y
1
[n]. Plot your results
using stem. Is the system causal?

(d) Now consider the signal y
2
[n] = x[n] * h
2
[n], where h
2
[n] = h
1
[n+5]. Compute y
2
[n] using conv.
Plot your result using stem. How does y
2
[n] compare to the signal y
1
[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
www.zaluu.com
www.zaluu.com
EIE/PolyU/LS102/Jan2008 3
of the conv function. For the sequences:

| | | | | |
| | | | | |, 2
and 1 2 1 2
+ =
+ =
n n n x
n n n h



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 for y 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,
| | | | | | | |. 2
2
1
and 2
2
|
.
|

\
|
= + =

n u n x n u n h
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] and x[n]. Store in the vector x the value of x[n] for 2 n 24
and store in the vector h the values of h[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 of y will be valid. Specify which values in the output are
valid 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
www.zaluu.com
www.zaluu.com
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.

www.zaluu.com
www.zaluu.com
EIE/PolyU/LS102/Jan2008 5
(a) Consider the following three signals:
| |


=
otherwise, , 0
, 4 0 , 1 n
n x | |

=
=
=
=
=
otherwise, , 0
, 4 , 1
, 2 , 3
, 1 , 1
, 0 , 1
1
n
n
n
n
n h | |

=
=
=
=
=
otherwise. , 0
, 4 , 1
, 3 , 4
, 2 , 5
, 1 , 2
2
n
n
n
n
n h
Define the MATLAB vector x to represent x[n] on the interval 0 n 9, and the vectors h1 and
h2 to represent h
1
[n] and h
2
[n] for 0 n 4. Also define nx to be an appropriate index vector for
x[n] and nh for h
1
[n] and h
2
[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.
| | | | | | | | | | n x n h n h n x n y * *
1 1
= = . (6)
This implies that, if x[n] is the input and h
1
[n] is the impulse response, the output is equivalent to
that of an LTI system with impulse response x[n] and input h
1
[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
| | | | | | ( ) | | | | | | | | n h n x n h n x n h n h n x
2 1 2 1
* * * + = + . (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 h
1
[n] and h
2
[n] when x[n] is the input. Compare this with the
output of the LTI system whose impulse response is h
1
[n]+h
2
[n] when the input is x[n]. Do these
two methods of computing the output give the same results?

(d) Convolution also possesses the associative property, i.e.,
| | | | ( ) | | | | | | | | ( ) n h n h n x n h n h n x
2 1 2 1
* * * * = . (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.
h
1
[n]
h
2
[n]
y[n]
x[n] h
1
[n]+h
2
[n] y[n] x[n]
+
www.zaluu.com
www.zaluu.com
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 h
1
[n], as shown in Fig. 4.
Compute w[n] by convolving x[n] and h
1
[n].
Compute the output y
1
[n] of the whole system by convolving w[n] with h
2
[n].
Find the impulse response h[n] = h
1
[n] * h
2
[n].
Convolve x[n] with h[n] to get the output y
2
[n].
Compare y
1
[n] and y
2
[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 if h[n] is the response to
the unit impulse [n], then the response of the system y[n] to any x[n] is determined by the
convolution 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:
x
1
[n] = [n]
x
2
[n] = [n1]
x
3
[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?
h
1
[n] h
2
[n] x[n] y[n] h
1
[n] * h
2
[n] x[n] y[n]
www.zaluu.com
www.zaluu.com
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:
x
1
[n] = [n],
x
2
[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.
www.zaluu.com
www.zaluu.com
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 in
Fig. 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

x
2
[n]
x
1
[n]
x
2
[n]
x
1
[n]
scale
+
System
System
System
scale
+
Output 1
Output 2
x
2
[n]
x
1
[n]
Graph 1 (top-left graph)
Graph 2 (top-right graph)
Graph 3
(bottom-left graph)
Graph 4
(bottom-right graph)
x
1
[n]
x
2
[n]
System
System
www.zaluu.com
www.zaluu.com

Vous aimerez peut-être aussi