## What Are State-Space Models?

### Definition of State-Space Models

*State-space models* are models that use state variables to describe a
system by a set of first-order differential or difference equations, rather than by one or more
*n*th-order differential or difference equations. If the set of first-order
differential equation is linear in the state and input variables, the model is referred to as a
*linear* state space model.

**Note**

Generally, the System Identification Toolbox™ documentation refers to linear state space models simply as state-space models. You can also identify nonlinear state space models using grey-box and neural state-space objects. For more information, see Available Nonlinear Models.

The linear state-space model structure is a good choice for quick estimation because it
requires you to specify only one parameter, the *model order*,
`n`

. The *model order* is an integer equal to the dimension
of *x(t)* and relates to, but is not necessarily equal to, the number of
delayed inputs and outputs used in the corresponding difference equation. State variables
*x(t)* can be reconstructed from the measured input-output data, but are not
themselves measured during an experiment.

### Continuous-Time Representation

It is often easier to define a parameterized state-space model in continuous time because physical laws are most often described in terms of differential equations. In continuous-time, the linear state-space description has the following form:

$$\begin{array}{l}\dot{x}(t)=Fx(t)+Gu(t)+\tilde{K}w(t)\\ y(t)=Hx(t)+Du(t)+w(t)\\ x(0)=x0\end{array}$$

The matrices *F*, *G*, *H*, and
*D* contain elements with physical significance—for example, material
constants. *x0* specifies the initial states.

**Note**

$$\tilde{K}$$ = 0 gives the state-space representation of an Output-Error model. For more information, see What Are Polynomial Models?.

You can estimate continuous-time state-space model using both time- and frequency-domain data.

### Discrete-Time Representation

The discrete-time linear state-space model structure is often written in the
*innovations form* that describes noise:

$$\begin{array}{l}x(kT+T)=Ax(kT)+Bu(kT)+Ke(kT)\\ y(kT)=Cx(kT)+Du(kT)+e(kT)\\ x(0)=x0\end{array}$$

where *T* is the sample time, *u(kT)* is the input at
time instant *kT*, and *y(kT)* is the output at time
instant *kT*.

**Note**

*K*=0 gives the state-space representation of an Output-Error model.
For more information about Output-Error models, see What Are Polynomial Models?.

Discrete-time state-space models provide the same type of linear difference relationship between the inputs and outputs as the linear ARMAX model, but are rearranged such that there is only one delay in the expressions.

You cannot estimate a discrete-time state-space model using continuous-time frequency-domain data.

The innovations form uses a single source of noise, *e(kT)*, rather than
independent process and measurement noise. If you have prior knowledge about the process and
measurement noise, you can use linear grey-box estimation to identify a state-space model with
structured independent noise sources. For more information, see Identifying State-Space Models with Separate Process and Measurement Noise Descriptions.

### Relationship Between Continuous-Time and Discrete-Time State Matrices

The relationships between the discrete state-space matrices *A*,
*B*, *C*, *D*, and
*K* and the continuous-time state-space matrices *F*,
*G*, *H*, *D*, and $$\tilde{K}$$ are given for piece-wise-constant input, as follows:

$$\begin{array}{l}A={e}^{FT}\\ B={\displaystyle \underset{0}{\overset{T}{\int}}{e}^{F\tau}Gd\tau}\\ C=H\end{array}$$

These relationships assume that the input is piece-wise-constant over time intervals $$kT\le t<(k+1)T$$.

The exact relationship between *K* and $$\tilde{K}$$ is complicated. However, for short sample time *T*, the
following approximation works well:

$$K={\displaystyle \underset{0}{\overset{T}{\int}}{e}^{F\tau}\tilde{K}d\tau}$$

### State-Space Representation of Transfer Functions

For linear models, the general model description is given by:

$$y=Gu+He$$

*G* is a transfer function that takes the input *u*
to the output *y*. *H* is a transfer function that
describes the properties of the additive output noise model.

The relationships between the transfer functions and the discrete-time state-space matrices are given by the following equations:

$$\begin{array}{l}G(q)=C{(}^{q}B+D\\ H(q)=C{(}^{q}K+{I}_{ny}\end{array}$$

Here, *I _{nx}* is the

*nx*-by-

*nx*identity matrix, and

*nx*is the number of states.

*I*is the

_{ny}*ny*-by-

*ny*identity matrix, and

*ny*is the dimension of

*y*and

*e*.

The state-space representation in the continuous-time case is similar.

## Related Examples

- Estimate State-Space Models in System Identification App
- Estimate State-Space Models at the Command Line