The lsim command is quite similar to the step command (actually, the step command is just a special case of lsim). Given a system described either by state-space equations or a transfer function, the lsim command can run a simulation of the system using arbitrary inputs and initial conditions.
The command lsim(A,B,C,D,U,T,X0) plots the time response of the linear system:
. x = Ax + Bu y = Cx + DuThat is, the differential equation is integrated from time T(0) to T(length(T)), starting at the initial condition X0 and using the input U. The input vector must have the same number of entries as the time vector. If the initial conditions are all zero, X0 can be omitted.
Suppose we have a system described by the state space-equations above, with A,B,C,D matrices:
When the lsim command is invoked with left-hand arguments,
Now let's plot the step response for the system given above; the input U is 1 for all positive time, and the initial condition is zero.
The plot above shows the step response of the system. We can also plot the response of the system to any other input that we choose. For example, if we had a sinusoidal input, say u(t) = 0.1 sin(5t+1):
Remember that the steady-state response of a linear system to a sinusoidal input will always be a sinusoid of the same frequency but with a different magnitude and phase.
This same sinusoidal response could also be found by transforming the state-space equations into the transfer function form:
Because any transfer function can be represented using many different sets of state-space matrices, you can only simulate a system in transfer function form with zero initial conditions; see the conversion page for more details.
Use your browser's "Back" button to return to the previous page.
8/28/96 YS