State-space models rely on linear differential equations or difference equations to describe system dynamics. Control System Toolbox™ software supports SISO or MIMO state-space models in continuous or discrete time. State-space models can include time delays. You can represent state-space models in either explicit or descriptor (implicit) form.

State-space models can result from:

Linearizing a set of ordinary differential equations that represent a physical model of the system.

State-space model identification using System Identification Toolbox™ software.

State-space realization of transfer functions. (See Conversion Between Model Types for more information.)

Use `ss`

model objects to represent
state-space models.

Explicit continuous-time state-space models have the following form:

$$\begin{array}{c}\frac{dx}{dt}=Ax+Bu\\ y=Cx+Du\end{array}$$

where *x* is the state vector. *u* is the
input vector, and * y* is the output vector. *A*,
*B*, *C*, and *D* are the
state-space matrices that express the system dynamics.

A discrete-time explicit state-space model takes the following form:

$$\begin{array}{c}x\left[n+1\right]=Ax\left[n\right]+Bu\left[n\right]\\ y\left[n\right]=Cx\left[n\right]+Du\left[n\right]\end{array}$$

where the vectors *x*[*n*],
*u*[*n*], and
*y*[*n*] are the state, input, and output
vectors for the *n*th sample.

A *descriptor state-space model* is a generalized
form of state-space model. In continuous time, a descriptor state-space model takes
the following form:

$$\begin{array}{c}E\frac{dx}{dt}=Ax+Bu\\ y=Cx+Du\end{array}$$

where *x* is the state vector. *u* is the
input vector, and * y* is the output vector. *A*,
*B*, *C*, *D*, and
*E* are the state-space matrices.

Use the commands described in the following table to create state-space models.

This example shows how to create a continuous-time single-input, single-output
(SISO) state-space model from state-space matrices using `ss`

.

Create a model of an electric motor where the state-space equations are:

$$\begin{array}{c}\frac{dx}{dt}=Ax+Bu\\ y=Cx+Du\end{array}$$

where the state variables are the angular position *θ* and
angular velocity *dθ*/*dt*:

$$x=\left[\begin{array}{c}\theta \\ \frac{d\theta}{dt}\end{array}\right],\text{\hspace{1em}}\text{\hspace{1em}}$$

*u* is the electric current, the output *y* is
the angular velocity, and the state-space matrices are:

$$A=\left[\begin{array}{cc}0& 1\\ -5& -2\end{array}\right],\text{\hspace{1em}}B=\left[\begin{array}{c}0\\ 3\end{array}\right],\text{\hspace{1em}}C=\left[\text{\hspace{0.05em}}\begin{array}{cc}0& 1\end{array}\right],\text{\hspace{1em}}D=\left[\text{\hspace{0.05em}}0\text{\hspace{0.05em}}\right].$$

To create this model, enter:

A = [0 1;-5 -2]; B = [0;3]; C = [0 1]; D = 0; sys = ss(A,B,C,D);

`sys`

is an `ss`

model object, which is a data
container for representing state-space models.

**Tip**

To represent a system of the form:

$$\begin{array}{c}E\frac{dx}{dt}=Ax+Bu\\ y=Cx+Du\end{array}$$

use `dss`

. This command creates a
`ss`

model with a nonempty `E`

matrix,
also called a descriptor state-space model. See MIMO Descriptor State-Space Models for an
example.