lsim (MathScript RT Module Function)
- Updated2023-03-14
- 3 minute(s) read
lsim (MathScript RT Module Function)
Owning Class: timeresp
Requires: Control Design and Simulation Module and MathScript RT Module
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.
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:
|
||||||||||||||||||||||||||||||||
| 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 linramp 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:
|
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. |
Details
The following table lists the support characteristics of this function.
| Supported in the LabVIEW Run-Time Engine | Yes (if you request output) |
| Supported on RT targets | Yes (if you request output) |
| Suitable for bounded execution times on RT | Not characterized |
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)