Implement linear state-space system

Continuous

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

$$\begin{array}{l}\dot{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 *x*0
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}\dot{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.

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

.

For more information, see Data Types Supported by Simulink in the Simulink documentation.

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

**Default:** `1`

Parameter: `A` |

Type: matrix |

Value: `'1'` |

Default: `'1'` |

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

**Default:** `1`

Parameter: `B` |

Type: matrix |

Value: `'1'` |

Default: `'1'` |

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

**Default:** `1`

Parameter: `C` |

Type: matrix |

Value: `'1'` |

Default: `'1'` |

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

**Default:** `1`

Parameter: ` D` |

Type: matrix |

Value: `'1'` |

Default: `'1'` |

Specify the initial state vector.

**Default:** `0`

The initial conditions of this block cannot be `inf`

or `NaN`

.

Parameter: ` X0` |

Type: vector |

Value: `'0'` |

Default: `'0'` |

Specify the absolute tolerance for computing block states.

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

Parameter: ` AbsoluteTolerance` |

Type: string, scalar, or
vector |

Value: `'auto'` | `'-1'` |
any positive real scalar or vector |

Default: ` 'auto'` |

Assign a unique name to each state.

**Default:** `' '`

If this field is blank, no name assignment occurs.

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.

Parameter: `ContinuousStateAttributes` |

Type: string |

Value: `' '` |
user-defined |

Default: `' '` |

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

Data Types | Double |

Sample Time | Continuous |

Direct Feedthrough | Only if |

Multidimensional Signals | No |

Variable-Size Signals | No |

Zero-Crossing Detection | No |

Code Generation | Yes |

Was this topic helpful?