# State-Space

Implement linear state-space system

Continuous

## Description

The State-Space block implements a system whose behavior you define as

$\begin{array}{l}\stackrel{˙}{x}=Ax+Bu\\ y=Cx+Du\\ {x|}_{t={t}_{0}}={x}_{0},\end{array}$

where x is the state vector, u is the input vector, y is the output vector and x0 is the initial condition of the state vector. The matrix coefficients must have these characteristics:

• 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.

In general, the block has one input port and one output port. The number of rows in C or D matrix is the same as the width of the output port. The number of columns in the B or D matrix are the same as the width of the input port. If you want to model an autonomous linear system with no inputs, set the B and D matrices to empty. In this case, the block acts as a source block with no input port and one output port, and implements the following system:

$\begin{array}{l}\stackrel{˙}{x}=Ax\\ y=Cx\\ {x|}_{t={t}_{0}}={x}_{0}.\end{array}$

Simulink® software converts a matrix containing zeros to a sparse matrix for efficient multiplication.

## Data Type Support

A State-Space block accepts and outputs real signals of type `double`.

## Parameters and Dialog Box

### A

Specify the n-by-n matrix coefficient, where n is the number of states.

#### Settings

Default: `1`

#### Command-Line Information

 Parameter: `A` Type: matrix Value: `'1'` Default: `'1'`

### B

Specify the n-by-m matrix coefficient, where n is the number of states and m is the number of inputs.

#### Settings

Default: `1`

#### Command-Line Information

 Parameter: `B` Type: matrix Value: `'1'` Default: `'1'`

### C

Specify the r-by-n matrix coefficient, where r is the number of outputs and n is the number of states.

#### Settings

Default: `1`

#### Command-Line Information

 Parameter: `C` Type: matrix Value: `'1'` Default: `'1'`

### D

Specify the r-by-m matrix coefficient, where r is the number of outputs and m is the number of inputs.

#### Settings

Default: `1`

#### Command-Line Information

 Parameter: ` D` Type: matrix Value: `'1'` Default: `'1'`

### Initial conditions

Specify the initial state vector.

#### Settings

Default: `0`

The initial conditions of this block cannot be `inf` or `NaN`.

#### Command-Line Information

 Parameter: ` X0` Type: vector Value: `'0'` Default: `'0'`

### Absolute tolerance

Specify the absolute tolerance for computing block states.

#### Settings

Default: `auto`

• You can enter `auto`, –1, a positive real scalar or vector.

• If you enter `auto` or –1, then Simulink uses the absolute tolerance value in the Configuration Parameters dialog box (see Solver Pane) to compute block states.

• If you enter a real scalar, then that value overrides the absolute tolerance in the Configuration Parameters dialog box for computing all block states.

• If you enter a real vector, then the dimension of that vector must match the dimension of the continuous states in the block. These values override the absolute tolerance in the Configuration Parameters dialog box.

#### Command-Line Information

 Parameter: ` AbsoluteTolerance` Type: string, scalar, or vector Value: `'auto'` | `'-1'` | any positive real scalar or vector Default: ` 'auto'`

### State Name (e.g., 'position')

Assign a unique name to each state.

#### Settings

Default: `' '`

If this field is blank, no name assignment occurs.

#### Tips

• To assign a name to a single state, enter the name between quotes, for example, `'velocity'`.

• 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 state names apply only to the selected block.

• The number of states must divide evenly among the number of state names.

• You can specify fewer names than states, but you cannot specify more names than states.

For example, you can specify two names in a system with four states. The first name applies to the first two states and the second name to the last two states.

• To assign state names with a variable in the MATLAB® workspace, enter the variable without quotes. A variable can be a string, cell array, or structure.

#### Command-Line Information

 Parameter: `ContinuousStateAttributes` Type: string Value: `' '` | user-defined Default: `' '`

## Examples

The following Simulink examples show how to use the State-Space block:

• `sldemo_dblcart1`

• `aero_vibrati`

## Characteristics

 Data Types Double Sample Time Continuous Direct Feedthrough Only if D ≠ 0 Multidimensional Signals No Variable-Size Signals No Zero-Crossing Detection No Code Generation Yes