User`s guide

Table Of Contents
lsim
11-127
simulatestheresponsesofseveralLTI modelstothesameinputhistoryt,u and
plots these responses on a single figure. As with
bode or plot, you can specify
a particular color, linestyle, and/or marker for each system, for example,
lsim(sys1,'y:',sys2,'g--',u,t,x0)
The mult isystem behavior is similar to that of bode or step.
When i nvoked with left-hand arguments,
[y,t] = lsim(sys,u,t)
[y,t,x] = lsim(sys,u,t) % for state-space models only
[y,t,x] = lsim(sys,u,t,x0) % with initial state
return the output response y, the time vector t used for simulation, and the
state trajectories
x (for state-space models only). No plot is drawn on the
screen. The ma trix
y hasasmanyrowsastimesamples(length(t))andas
many columnsas systemoutputs.Thesame holds for
x with“outputsreplaced
bystates. Notethatthe output
t may differfrom the specified time vector when
the input data is undersampled (see “Algorithm”).
Example Simulate and plot the response of t he system
to a square wave with period of four seconds. First generate the square wave
with
gensig. Sample every 0.1 second during 10 seconds:
[u,t] = gensig('square',4,10,0.1);
Hs()
2s
2
5s 1++
s
2
2s3++
-------------------------------
s 1
s
2
s 5++
------------------------
=