lsim (Control Design and Simulation Module, MathScript Function)

LabView Control Design MathScript Functions

lsim (Control Design and Simulation Module, MathScript Function)

Member of the timeresp class.

Syntax

lsim(SysIn, attributes, U, t)

lsim(SysIn, attributes, U, t, x0)

lsim(SysIn, attributes, U, t, method)

lsim(SysIn, attributes, U, t, x0, method)

[Y, T, X] = lsim(SysIn, attributes, U, t)

[Y, T, X] = lsim(SysIn, attributes, U, t, x0)

[Y, T, X] = lsim(SysIn, attributes, U, t, method)

[Y, T, X] = lsim(SysIn, attributes, U, t, x0, method)

Description

Creates the linear simulation plot of a system model. This function calculates the output of a system model when a set of inputs excite the model, using discrete simulation. If you do not specify an output, this function creates a plot.

Examples

Inputs

Name Description
SysIn Specifies a linear time-invariant (LTI) model in transfer function, zero-pole-gain, or state-space form.
attributes Specifies valid plot attributes. Order the plot attributes by color, point-style, and line-style. For example, 'bo-' specifies that the plot is blue, marks points with circles, and uses solid lines. attributes is a string that can take a combination of the following values:

'b' Colors the plot blue.
'c' Colors the plot cyan.
'g' Colors the plot green.
'k' Colors the plot black.
'm' Colors the plot magenta.
'r' Colors the plot red.
'y' Colors the plot yellow.
'.' Marks points with dots.
'o' Marks points with circles.
'x' Marks points with crosses.
'+' Marks points with plus signs.
'*' Marks points with asterisks.
'-' Uses solid lines.
':' Uses dotted lines.
'-.' Uses dashed and dotted lines.
'--' Uses dashed lines.
U Specifies the inputs that excite the SysIn model. If the SysIn model is discrete, ensure that the time step of the SysIn model matches the time step of the U input. U is a real matrix.
t Specifies a uniformly spaced time vector that contains information about the initial time, time step, and final time. You can format t as [t0:dt:tf], where t0 is the initial time, dt is the time step, and tf is the final time. You also can format t as [tf]. You also can use the linspace function to generate t. t is a real vector.
x0 Specifies the initial states of the SysIn model. The i-th element of this input corresponds to the i-th initial state. The default value is all zeros. x0 is a real vector.
method Specifies the method this function uses to convert the SysIn from continuous to discrete representation. method is a string that can take the following values:

'zoh' (Default) Converts the model using the Zero-Order-Hold method.
'foh' Converts the model using the First-Order-Hold method.

Outputs

Name Description
Y Returns the time response of the outputs of the SysIn model due to the conditions you specify in the x0 input. Y is a real matrix.
T Returns the uniformly spaced time vector this function uses to calculate the output response and the state trajectories. T is a real vector.
X Returns the time response of the states of the SysIn model due to the conditions you specify in the x0 input. X is a real matrix.

Examples

z = [1]
p = [-1, -2]
k = 0.5
SysIn = zpk(z, p, k)
t = [0:0.1:10]
u = sin(0.1*pi*t)'
lsim(SysIn, u, t)

Related Topics

initial