## State-Space Realizations

A *state-space realization* is an implementation of a given
input-output behavior. If a system is modeled by a transfer matrix
*H*(*s*), then a realization is a set of matrices
*A*, *B*, *C*, *D*
such that $$H\left(s\right)=C{\left(sI-A\right)}^{-1}B+D$$. In other words, if the system has state vector *x*, the
system behavior can be described by the following state equations:

$$\begin{array}{l}\dot{x}=Ax+Bu\\ y=Cx+Du.\end{array}$$

There are an infinite number of possible realizations of any system. A *minimal
realization* is any realization in which *A* has the
smallest possible dimension. That is, a given realization *A*,
*B*, *C*, *D* is minimal if there is
no other realization *A'*, *B'*, *C'*,
*D'* where *A'* has smaller dimensions than
*A*.

A *state transformation* is a rotation of the state vector by an
invertible matrix *T* such that $$\widehat{x}=Tx$$. State transformation yields an equivalent state-space representation of
the system, with

$$\begin{array}{l}\widehat{A}=TA{T}^{-1}\\ \widehat{B}=TB\\ \widehat{C}=C{T}^{-1}\\ \widehat{D}=D.\end{array}$$

Certain minimal realizations known as *canonical forms* can be useful
for some types of dynamic-system theory and analysis. This topic summarizes some of these
canonical forms and related transformations.

### Modal Form

Modal form is a diagonalized form that separates the system eigenvalues. In modal
form, *A* or (*A*,*E*) are
block-diagonal. The block size is typically 1-by-1 for real eigenvalues and 2-by-2 for
complex eigenvalues. However, if there are repeated eigenvalues or clusters of nearby
eigenvalues, the block size can be larger.

For instance, for a system with eigenvalues $$({\lambda}_{1},\sigma \pm j\omega ,{\lambda}_{2})$$, the modal *A* matrix is of the form

$${A}_{m}=\left[\begin{array}{cccc}{\lambda}_{1}& 0& 0& 0\\ 0& \sigma & \omega & 0\\ 0& -\omega & \sigma & 0\\ 0& 0& 0& {\lambda}_{2}\end{array}\right].$$

#### Obtaining Modal Form

To obtain the modal form, use the `modalreal`

command, ```
[msys,blks] =
modalreal(sys)
```

.

When performing system identification using `ssest`

(System Identification Toolbox), obtain modal form by setting `Form`

to
`modal`

.

### Controllable Companion Form

In companion realizations, the characteristic polynomial of the system appears
explicitly in the *A* matrix. For a SISO system with characteristic
polynomial

$$P(s)={s}^{n}+{\alpha}_{n-1}{s}^{n-1}+{\alpha}_{n-2}{s}^{n-2}+\dots +{\alpha}_{1}s+{\alpha}_{0},$$

the corresponding controllable companion form has

$${A}_{ccom}=\left[\begin{array}{ccc}\begin{array}{l}0\\ 1\\ 0\\ 0\\ \vdots \\ 0\end{array}& \begin{array}{l}0\\ 0\\ 1\\ 0\\ \vdots \\ 0\end{array}& \begin{array}{ccc}\begin{array}{cc}\begin{array}{l}0\\ 0\\ 0\\ 1\\ \vdots \\ 0\end{array}& \begin{array}{l}\dots \\ \dots \\ \dots \\ \dots \\ \ddots \\ \dots \end{array}\end{array}& \begin{array}{l}0\\ 0\\ 0\\ 0\\ \vdots \\ 1\end{array}& \begin{array}{l}-{\alpha}_{0}\\ -{\alpha}_{1}\\ -{\alpha}_{2}\\ -{\alpha}_{3}\\ \text{}\vdots \\ -{\alpha}_{n-1}\end{array}\end{array}\end{array}\right],\text{\hspace{1em}}{B}_{ccom}=\left[\begin{array}{c}1\\ 0\\ \vdots \\ 0\end{array}\right].$$

For multi-input systems, *A _{ccom}* has the same
form, and the first column of

*B*is as shown. This form does not impose a particular structure on the rest of

_{ccom}*B*or on

_{ccom}*C*and

_{ccom}*D*.

_{ccom}#### Obtaining Controllable Companion Form

The command `csys = compreal(H,"c")`

computes a controllable
companion-form realization of `H`

by using the state transformation
`T = ctrb(H.A,H.B)`

to put the *A* matrix into
companion form.

When performing system identification using commands such as `ssest`

(System Identification Toolbox) or `n4sid`

(System Identification Toolbox), obtain companion form by
setting `Form`

to `companion`

.

The companion transformation requires that the system be controllable from the first input. The transformation to companion form is based on the controllability matrix, which is almost always numerically singular for mid-range orders. Hence, avoid using it for computation when possible.

### Observable Companion Form

A related form is obtained using the observability state transformation ```
T =
obsv(H.A,H.B)
```

instead of `T = ctrb(H.A,H.B)`

. This form
is the dual (transpose) of controllable companion form, as follows:

$$\begin{array}{l}{A}_{ocom}={A}_{ccom}^{T}\\ {B}_{ocom}={C}_{ccom}^{T}\\ {C}_{ocom}={B}_{ccom}^{T}\\ {D}_{ocom}={D}_{ccom}^{T}.\end{array}$$

In particular,

$${A}_{ocom}=\left[\begin{array}{ccc}\begin{array}{l}0\\ 0\\ 0\\ \vdots \\ 0\\ -{\alpha}_{0}\end{array}& \begin{array}{l}1\\ 0\\ 0\\ \vdots \\ 0\\ -{\alpha}_{1}\end{array}& \begin{array}{ccc}\begin{array}{cc}\begin{array}{l}0\\ 1\\ 0\\ \vdots \\ 0\\ -{\alpha}_{2}\end{array}& \begin{array}{l}0\\ 0\\ 1\\ \vdots \\ 0\\ -{\alpha}_{3}\end{array}\end{array}& \begin{array}{l}\dots \\ \dots \\ \dots \\ \ddots \\ \dots \\ \dots \end{array}& \begin{array}{l}0\\ 0\\ 0\\ \vdots \\ 1\\ -{\alpha}_{n-1}\end{array}\end{array}\end{array}\right],\text{\hspace{1em}}{C}_{ocom}=\left[\begin{array}{cccc}1& 0& \dots & 0\end{array}\right].$$

This form is sometimes known as *observability canonical form*
[1], but it is different from
observable canonical
form.

#### Obtaining Observable Companion Form

The command `csys = compreal(H,"o")`

computes an observable
companion-form realization of `H`

by using the state transformation
`T = ctrb(H.A,H.B)`

to put the *A* matrix into
companion form.

When performing system identification using commands such as `ssest`

(System Identification Toolbox) or `n4sid`

(System Identification Toolbox), obtain this form by setting
`Form`

to `canonical`

.

### Controllable Canonical Form

For a strictly proper system with the transfer function

$$H\left(s\right)=\frac{{\beta}_{n-1}{s}^{n-1}+\dots +{\beta}_{1}s+{\beta}_{0}}{{s}^{n}+{\alpha}_{n-1}{s}^{n-1}+\dots +{\alpha}_{1}s+{\alpha}_{0}}+{d}_{0},$$

the controllable canonical form [2] is given by:

$$\begin{array}{l}{A}_{cont}=\left[\begin{array}{ccc}\begin{array}{l}0\\ 0\\ 0\\ \vdots \\ 0\\ -{\alpha}_{0}\end{array}& \begin{array}{l}1\\ 0\\ 0\\ \vdots \\ 0\\ -{\alpha}_{1}\end{array}& \begin{array}{ccc}\begin{array}{cc}\begin{array}{l}0\\ 1\\ 0\\ \vdots \\ 0\\ -{\alpha}_{2}\end{array}& \begin{array}{l}0\\ 0\\ 1\\ \vdots \\ 0\\ -{\alpha}_{3}\end{array}\end{array}& \begin{array}{l}\dots \\ \dots \\ \dots \\ \ddots \\ \dots \\ \dots \end{array}& \begin{array}{l}0\\ 0\\ 0\\ \vdots \\ 1\\ -{\alpha}_{n-1}\end{array}\end{array}\end{array}\right],\text{\hspace{1em}}{B}_{cont}=\left[\begin{array}{c}0\\ 0\\ \vdots \\ \begin{array}{l}0\\ 1\end{array}\end{array}\right],\\ {C}_{cont}=\left[\begin{array}{cccc}{\beta}_{0}& {\beta}_{1}& \dots & {\beta}_{n-1}\end{array}\right],\text{\hspace{1em}}\text{\hspace{1em}}\text{\hspace{1em}}\text{\hspace{1em}}\text{\hspace{1em}}\text{\hspace{1em}}\text{\hspace{1em}}\text{\hspace{1em}}\text{\hspace{0.17em}}{D}_{cont}={d}_{0}.\end{array}$$

This form is also known as *phase-variable canonical form*. In
this form, the coefficients of the characteristic polynomial appear in the last row of
*A _{cont}*. Controllable canonical form is
a minimal realization in which all model states are controllable. Like companion form
and observable canonical form, it can be ill-conditioned for computation.

#### Obtaining Controllable Canonical Form

There is no MATLAB^{®} command for directly computing controllable canonical form. However,
if you can obtain the system in the transfer-function form
*H*(*s*), then you can use the coefficients *ɑ*_{0},…,*ɑ*_{n–1}, *β*_{0},…,*β*_{n–1}, and *d*_{0} to construct the
controllable canonical-form matrices in MATLAB. Then, create the system with the `ss`

command..

### Observable Canonical Form

The observable canonical form of a system is the dual (transpose) of its controllable
canonical form. In this form, the characteristic polynomial of the system appears
explicitly in the last column of the `A`

matrix. Observable canonical
form can be obtained from the controllable canonical form as follows:

$$\begin{array}{l}{A}_{obs}={A}_{cont}^{T}\\ {B}_{obs}={C}_{cont}^{T}\\ {C}_{obs}={B}_{cont}^{T}\\ {D}_{obs}={D}_{cont}^{T}.\end{array}$$

Thus, for the system with transfer function

$$H\left(s\right)=\frac{{\beta}_{n-1}{s}^{n-1}+\dots +{\beta}_{1}s+{\beta}_{0}}{{s}^{n}+{\alpha}_{n-1}{s}^{n-1}+\dots +{\alpha}_{1}s+{\alpha}_{0}}+{d}_{0},$$

the observable canonical form [2] is given by:

$$\begin{array}{l}{A}_{obs}=\left[\begin{array}{ccc}\begin{array}{l}0\\ 1\\ 0\\ 0\\ \vdots \\ 0\end{array}& \begin{array}{l}0\\ 0\\ 1\\ 0\\ \vdots \\ 0\end{array}& \begin{array}{ccc}\begin{array}{cc}\begin{array}{l}0\\ 0\\ 0\\ 1\\ \vdots \\ 0\end{array}& \begin{array}{l}\dots \\ \dots \\ \dots \\ \dots \\ \ddots \\ \dots \end{array}\end{array}& \begin{array}{l}0\\ 0\\ 0\\ 0\\ \vdots \\ 1\end{array}& \begin{array}{l}-{\alpha}_{0}\\ -{\alpha}_{1}\\ -{\alpha}_{2}\\ -{\alpha}_{3}\\ \text{}\vdots \\ -{\alpha}_{n-1}\end{array}\end{array}\end{array}\right],\text{\hspace{1em}}{B}_{obs}=\left[\begin{array}{c}{\beta}_{0}\\ {\beta}_{1}\\ {\beta}_{2}\\ \begin{array}{l}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\vdots \\ {\beta}_{n-1}\end{array}\end{array}\right],\\ {C}_{obs}=\left[\begin{array}{cccc}0& 0& \begin{array}{cc}\dots & 0\end{array}& 1\end{array}\right],\text{\hspace{1em}}\text{\hspace{1em}}\text{\hspace{1em}}\text{\hspace{1em}}\text{\hspace{1em}}{D}_{obs}={d}_{0}.\end{array}$$

Like the companion form, in this form, the coefficients of the characteristic
polynomial appear in the last column of *A _{obs}*.
Observable canonical form is a minimal realization in which all model states are
observable.

#### Obtaining Observable Canonical Form

As with controllable canonical form, there is no MATLAB command for directly computing observable canonical form. However, if
you can obtain the system in the transfer-function form
*H*(*s*), then you can use the coefficients *ɑ*_{0},…,*ɑ*_{n–1}, *β*_{0},…,*β*_{n–1}, and *d*_{0} to construct the
observable canonical-form matrices in MATLAB. Then, create the system with the `ss`

command.

## References

[1] Baillieul, John, "Observability Canonical Form and the Theory of Observers," lecture notes, November 15, 2012, accessed June 10, 2022, https://people.bu.edu/johnb/501Lecture19.pdf.

[2] Gillis, James T., "State
Space." In *Control System Fundamentals.*, edited by William S.
Levine, 2d ed. The Electrical Engineering Handbook Series. Boca Raton: CRC Press, 2011.

## See Also

`modalreal`

| `compreal`

| `ss`

| `ssest`

(System Identification Toolbox) | `n4sid`

(System Identification Toolbox)