Discrete Varying State Space
Discrete-time state-space model with varying matrix values
Control System Toolbox / Linear Parameter Varying
Use this block to implement a discrete-time state-space model with varying matrices. Feed the instantaneous values of the state matrix A, input matrix B, output matrix C, and feedforward matrix D to the corresponding input ports. The system response is given by:
where uk is the system input, yk is the system output, xk is the current system state, and xk+1 is the system state at the next time step.
Use this block and the other blocks in the Linear Parameter Varying library to implement common control elements with variable parameters or coefficients. For more information, see Model Gain-Scheduled Control Systems in Simulink.
Avoid making the C and D matrices depend on the system output yk. If you have such dependence, the resulting state-space equation yk = C(yk)xk + D(yk)uk creates an algebraic loop, because computing the output value yk requires knowing the output value. This algebraic loop is prone to instability and divergence. Instead, try expressing C and D in terms of the time t, the block input uk, and the state outputs xk.
For similar reasons, avoid making A and B depend on the xk+1 output. Note that it is safe for A and B to depend on yk when yk is a fixed combination of states and inputs (in other words, when yk = Cxk + Duk, where C and D are constant matrices).
uk — System input
scalar | vector
System input signal.
A — State matrix
State matrix of dimensions Nx-by-Nx, where Nx is the number of system states.
B — Input matrix
Input matrix of dimensions Nx-by-Nu, where Nu is the number of system inputs.
C — Output matrix
Output matrix Ny-by-Nx, where Ny is the number of system outputs.
D — Feedforward matrix
Feedforward matrix of dimensions Ny-by-Nu.
For a zero-feedthrough state-space model, clear the Enable feedthrough checkbox. Clearing this checkbox disables the D input port. (since R2023a)
yk — System output
scalar | vector
System output signal.
xk — Current state vector
Current state values.
To enable this port, select the Output states parameter.
xk+1 — Next state vector
State values at next time step.
To enable this port, select the Output state updates parameter.
Initial conditions — System initial conditions
0 (default) | scalar | vector
Initial state values, specified as a scalar or a vector whose length is the number of system states.
Sample time (-1 for inherited) — Block sample time
–1 (default) | positive scalar
Block sample time, specified as either –1 (inherited sample time) or a positive scalar value.
Output states — Provide state output
on (default) | off
Select to enable the state values output port, x.
Output state derivatives — Provide state updates
on (default) | off
Select to enable the state updates output port, xk+1.
Enable feedthrough — Add input port for feedthrough matrix
on (default) |
Enable the D input port for a state-space model with direct feedthrough. For a zero-feedthrough model, clear this checkbox. Disabling the port for zero-feedthrough models is numerically more reliable than feeding a zero-constant into the port.
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.
Version HistoryIntroduced in R2017b
R2023a: Enable feedthrough checkbox added
For a zero-feedthrough state-space model, clear the Enable feedthrough checkbox. Clearing this checkbox disables the D input port. Disabling the port for zero-feedthrough models is numerically more reliable than feeding a zero-constant into the port.