| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
Discrete

The Discrete State-Space block implements the system described by
![]()
where u is the input, x is the state, and y is the output. The matrix coefficients must have these characteristics, as illustrated in the following diagram:
A must be an n-by-n matrix, where n is the number of states.
B must be an n-by-m matrix, where m is the number of inputs.
C must be an r-by-n matrix, where r is the number of outputs.
D must be an r-by-m matrix.

The block accepts one input and generates one output. The input vector width is determined by the number of columns in the B and D matrices. The output vector width is determined by the number of rows in the C and D matrices.
Simulink software converts a matrix containing zeros to a sparse matrix for efficient multiplication.
The Discrete State Space block accepts and outputs a real signal of type single or double.
The Main tab of the Discrete State-Space block dialog box appears as follows:

The matrix coefficients, as defined in the preceding equations.
The initial state vector. The default is 0. Simulink software does not allow the initial states of this block to be inf or NaN.
The time interval between samples. See Specifying Sample Time.
The State Attributes tab of the Discrete State-Space block dialog box appears as follows:

Use this parameter to assign a unique name to each state. The default is ' '. If left blank, no name is assigned. Consider the following when using this parameter:
To assign a name to a single state, enter the name between quotes, for example, 'velocity' .
The state names apply only to the selected block.
To assign names to multiple states, enter a comma-delimited list surrounded by braces. For example, {'a', 'b', 'c'} . Each name must be unique.
The number of states must be evenly divided by the number of state names. You can have fewer names than states, but you cannot have more names than states.
For example, you can specify two names in a system with four states. Simulink assigns the first name to the first two states and the second name to the last two.
To assign state names with a variable that has been defined in the MATLAB workspace, enter the variable without quotes. A variable can be a string, cell, or structure.
This parameter enables State name must resolve to Simulink signal object when you click the Apply button.
Select this check box to require that the state name resolve to the Simulink signal object. This check box is cleared by default.
This parameter is enabled by State name.
Selecting this check box enables Real-Time Workshop storage class.
From the list, select state storage class.
Auto is the appropriate storage class for states that you do not need to interface to external code.
State is stored in a global variable
model_private.h declares the state as an extern variable.
model_private.h declares the state as an extern pointer.
This parameter is enabled by State name.
Setting this parameter to ExportedGlobal, ImportedExtern, or ImportedExternPointer enables Real-Time Workshop storage type qualifier.
During simulation, the block uses the following values:
The initial value of the signal object to which the state name is resolved
Min and Max values of the signal object
See Block State Storage and Interfacing Considerations in the Real-Time Workshop User's Guide for more information.
Direct Feedthrough | Only if D ≠ 0 |
Sample Time | Specified in the Sample time parameter |
Scalar Expansion | Yes, of the initial conditions |
States | Determined by the size of A |
Dimensionalized | Yes |
Zero Crossing | No |
![]() | Discrete FIR Filter | Discrete-Time Integrator | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |