# gram

Controllability and observability Gramians

## Description

Use `gram`

to construct the controllability and observability
Gramians. You can use Gramians to study the controllability and observability properties
of state-space models and for model reduction [1]. They have better numerical properties than the controllability and observability
matrices formed by `ctrb`

and `obsv`

.

calculates time-limited or frequency-limited Gramians. `W`

= gram(___,`opt`

)`opt`

is an option set that specifies time or frequency intervals for the computation.
Create `opt`

using the `gramOptions`

command.

## Examples

## Input Arguments

## Output Arguments

## Limitations

The *A* matrix must be stable (all eigenvalues have negative real
part in continuous time, and magnitude strictly less than one in discrete time).

## More About

## Algorithms

The controllability Gramian *W _{c}* is obtained
by solving the continuous-time Lyapunov equation

$$A{W}_{c}+{W}_{c}{A}^{T}+B{B}^{T}=0$$

or its discrete-time counterpart

$$A{W}_{c}{A}^{T}-{W}_{c}+B{B}^{T}=0$$

Similarly, the observability Gramian *W _{o}*
solves the Lyapunov equation

$${A}^{T}{W}_{o}+{W}_{o}A+{C}^{T}C=0$$

in continuous time, and the Lyapunov equation

$${A}^{T}{W}_{o}A-{W}_{o}+{C}^{T}C=0$$

in discrete time.

The computation of time-limited and frequency-limited Gramians is as described in [2].

## References

[1] Kailath, Thomas. *Linear
Systems*. Prentice-Hall Information and System Science Series. Englewood
Cliffs, N.J: Prentice-Hall, 1980.

[2] Gawronski, Wodek, and Jer-Nan Juang. “Model Reduction in
Limited Time and Frequency Intervals.” *International Journal of
Systems Science* 21, no. 2 (February 1990): 349–76.
https://doi.org/10.1080/00207729008910366.

## Version History

**Introduced before R2006a**

## See Also

`gramOptions`

| `hsvd`

| `balreal`

| `lyap`

| `dlyap`