Plot simulated time response of dynamic system to arbitrary inputs; simulated response data
lsim(
plots the simulated time response of the dynamic system model
sys,u,t)sys to the input history
(t,u). The vector t
specifies the time samples for the simulation. For single-input systems, the input signal
u is a vector of the same length as t. For
multi-input systems, u is an array with as many rows as there are
time samples (length(t)) and as many columns as there are inputs to
sys.
lsim(
simulates the responses of several dynamic system models to the same input history and
plots these responses on a single figure. All systems must have the same number of inputs
and outputs. You can also use the sys1,sys2,...,sysN,u,t,___)x0 and method
input arguments when computing the responses of multiple models.
returns the system response y = lsim(sys,u,t)y, sampled at the same times
t as the input. For single-output systems, y
is a vector of the same length as t. For multi-output systems,
y is an array having as many rows as there are time samples
(length(t)) and as many columns as there are outputs in
sys. This syntax does not generate a plot.
lsim( opens the Linear Simulation Tool.
For more information about using this tool for linear analysis, see Working with the Linear Simulation
Tool.sys)
When you need additional plot customization options, use lsimplot instead.
For a discrete-time transfer function,
lsim filters the input based on the recursion associated with this
transfer function:
For discrete-time zpk models, lsim filters the input
through a series of first-order or second-order sections. This approach avoids forming the
numerator and denominator polynomials, which can cause numerical instability for higher-order
models.
For discrete-time state-space models, lsim propagates the
discrete-time state-space equations,
For continuous-time systems, lsim first discretizes the system using
c2d, and then propagates the resulting discrete-time state-space
equations. Unless you specify otherwise with the method input argument,
lsim uses the first-order-hold discretization method when the input
signal is smooth, and zero-order hold when the input signal is discontinuous, such as for
pulses or square waves. The sample time for discretization is the spacing
dT between the time samples you supply in t.