Documentation Center

  • Trials
  • Product Updates

lsimplot

Simulate response of dynamic system to arbitrary inputs and return plot handle

Syntax

h = lsimplot(sys)
lsimplot(sys1,sys2,...)
lsimplot(sys,u,t)
lsimplot(sys,u,t,x0)
lsimplot(sys1,sys2,...,u,t,x0)
lsimplot(AX,...)
lsimplot(..., plotoptions)
lsimplot(sys,u,t,x0,'zoh')
lsimplot(sys,u,t,x0,'foh')

Description

h = lsimplot(sys) opens the Linear Simulation Tool for the dynamic system model sys, which enables interactive specification of driving input(s), the time vector, and initial state. It also returns the plot handle h. You can use this handle to customize the plot with the getoptions and setoptions commands. Type

help timeoptions 

for a list of available plot options.

lsimplot(sys1,sys2,...) opens the Linear Simulation Tool for multiple models sys1,sys2,.... Driving inputs are common to all specified systems but initial conditions can be specified separately for each.

lsimplot(sys,u,t) plots the time response of the model sys to the input signal described by u and t. The time vector t consists of regularly spaced time samples (in system time units, specified in the TimeUnit property of sys). For MIMO systems, u is a matrix with as many columns as inputs and whose ith row specifies the input value at time t(i). For SISO systems u can be specified either as a row or column vector. For example,

t = 0:0.01:5;   
u = sin(t);   
lsimplot(sys,u,t) 

simulates the response of a single-input model sys to the input u(t)=sin(t) during 5 seconds.

For discrete-time models, u should be sampled at the same rate as sys (t is then redundant and can be omitted or set to the empty matrix).

For continuous-time models, choose the sampling period t(2)-t(1) small enough to accurately describe the input u. lsim issues a warning when u is undersampled, and hidden oscillations can occur.

lsimplot(sys,u,t,x0) specifies the initial state vector x0 at time t(1) (for state-space models only). x0 is set to zero when omitted.

lsimplot(sys1,sys2,...,u,t,x0) simulates the responses of multiple LTI models sys1,sys2,... on a single plot. The initial condition x0 is optional. You can also specify a color, line style, and marker for each system, as in

lsimplot(sys1,'r',sys2,'y--',sys3,'gx',u,t)

lsimplot(AX,...) plots into the axes with handle AX.

lsimplot(..., plotoptions) plots the initial condition response with the options specified in plotoptions. Type

help timeoptions 

for more detail.

For continuous-time models, lsimplot(sys,u,t,x0,'zoh') or lsimplot(sys,u,t,x0,'foh') explicitly specifies how the input values should be interpolated between samples (zero-order hold or linear interpolation). By default, lsimplot selects the interpolation method automatically based on the smoothness of the signal u.

See Also

| |

Was this topic helpful?