aa
Section 5–5 / Transient-Response Analysis with MATLAB 201
Obtaining Response to Arbitrary Input. To obtain the response to an arbitrary
input, the command lsimmay be used. The commands like
lsim(num,den,r,t)
lsim(A,B,C,D,u,t)
y = lsim(num,den,r,t)
y = lsim(A,B,C,D,u,t)
will generate the response to input time function roru. See the following two examples.
(Also, see Problems A–5–14throughA–5–16.)
EXAMPLE 5–6 Using the lsimcommand, obtain the unit-ramp response of the following system:
We may enter MATLAB Program 5–12 into the computer to obtain the unit-ramp response. The
resulting plot is shown in Figure 5–28.
C(s)
R(s)
=
2 s+ 1
s^2 +s+ 1
MATLAB Program 5–12
% ------- Ramp Response -------
num = [2 1];
den = [1 1 1];
t = 0:0.1:10;
r = t;
y = lsim(num,den,r,t);
plot(t,r,'-',t,y,'o')
grid
title('Unit-Ramp Response Obtained by Use of Command "lsim"')
xlabel('t Sec')
ylabel('Unit-Ramp Input and System Output')
text(6.3,4.6,'Unit-Ramp Input')
text(4.75,9.0,'Output')
Unit-Ramp Response Obtained by use of Command “Isim”
t Sec
012345678910
Un
it-Ramp Input and System Output
12
0
4
2
6
8
10
Output
Unit-Ramp Input
Figure 5–28
Unit-ramp response.