# Control Systems/Controllability and Observability

| The Wikibook of: Control Systems and Control Engineering | Table of Contents | All Versions | PDF Version |
| The Wikibook of: Control Systems and Control Engineering | ← Nyquist Stability Criteria | System Specifications → | Glossary |

## System Interaction

In the world of control engineering, there are a slew of systems available that need to be controlled. The task of a control engineer is to design controller and compensator units to interact with these pre-existing systems. However, some systems simply cannot be controlled (or, more often, cannot be controlled in specific ways). The concept of controllability refers to the ability of a controller to arbitrarily alter the functionality of the system plant.
The state-variable of a system, x, represents the internal workings of the system that can be separate from the regular input-output relationship of the system. This also needs to be measured, or observed. The term observability describes whether the internal state variables of the system can be externally measured.

## Controllability

Complete state controllability (or simply controllability if no other context is given) describes the ability of an external input to move the internal state of a system from any initial state to any other final state in a finite time interval
We will start off with the definitions of the term controllability, and the related terms reachability and stabilizability.

### Controllability

    A system with internal state vector x is called controllable if and only if the system states can be changed by changing the system input.

### Reachability

    A particular state x$_1$ is called reachable if there exists an input that transfers the state of the system from the initial state x$_0$ to x$_1$ in some finite time interval [t$_0$, t).

### Stabilizability

    A system is Stabilizable if all states that cannot be reached decay to zero asymptotically.
We can also write out the definition of reachability more precisely:
A state x$_1$ is called reachable at time t$_1$ if for some finite initial time t$_0$ there exists an input u(t) that transfers the state x(t) from the origin at t$_0$ to x$_1$.
A system is reachable at time t$_1$ if every state x$_1$ in the state-space is reachable at time t$_1$.
Similarly, we can more precisely define the concept of controllability:
A state x$_0$ is controllable at time t$_0$ if for some finite time t$_1$ there exists an input u(t) that transfers the state x(t) from x$_0$ to the origin at time t$_1$.
A system is called controllable at time t$_0$ if every state x$_0$ in the state-space is controllable.

### Controllability Matrix

For LTI (linear time-invariant) systems, a system is reachable if and only if its controllability matrix, ζ, has a full row rank of p, where p is the dimension of the matrix A, and p × q is the dimension of matrix B.
[Controllability Matrix]
    $\zeta ={\begin{bmatrix}B&AB&A^{2}B&\cdots &A^{p-1}B\end{bmatrix}}\in R^{p\times pq}$
A system is controllable or "Controllable to the origin" when any state x$_1$ can be driven to the zero state x = 0 in a finite number of steps.
A system is controllable when the rank of the system matrix A is p, and the rank of the controllability matrix is equal to:
    $Rank(\zeta )=Rank(A^{-1}\zeta )=p$
If the second equation is not satisfied, the system is not .
MATLAB allows one to easily create the controllability matrix with the ctrb command. To create the controllability matrix $\zeta$ simply type
    $\zeta =ctrb(A,B)$
where A and B are mentioned above. Then in order to determine if the system is controllable or not one can use the rank command to determine if it has full rank.
If
    $Rank(A)<p$
Then controllability does not imply reachability.
* Reachability always implies controllability.
* Controllability only implies reachability when the state transition matrix is nonsingular.

### Determining Reachability

There are four methods that can be used to determine if a system is reachable or not:
* If the p rows of $\phi (t,\tau )B(t)$ are linearly independent over the field of complex numbers. That is, if the rank of the product of those two matrices is equal to p for all values of t and τ
* If the rank of the controllability matrix is the same as the rank of the system matrix A.
* If the rank of $\operatorname {rank} [\lambda I-A,B]=p$ for all eigenvalues λ of the matrix A.
* If the rank of the reachability gramian (described below) is equal to the rank of the system matrix A.
Each one of these conditions is both necessary and sufficient. If any one test fails, all the tests will fail, and the system is not reachable. If any test is positive, then all the tests will be positive, and the system is reachable.

### Gramians

Gramians are complicated mathematical functions that can be used to determine specific things about a system. For instance, we can use gramians to determine whether a system is controllable or reachable. Gramians, because they are more complicated than other methods, are typically only used when other methods of analyzing a system fail (or are too difficult).
All the gramians presented on this page are all matrices with dimension p × p (the same size as the system matrix A).
All the gramians presented here will be described using the general case of Linear time-variant systems. To change these into LTI (time-invariant equations), the following substitutions can be used:
    $\phi (t,\tau )\to e^{A(t-\tau )}$
    $\phi '(t,\tau )\to e^{A'(t-\tau )}$
Where we are using the notation X' to denote the transpose of a matrix X (as opposed to the traditional notation X$^T$).

### Reachability Gramian

We can define the reachability gramian as the following integral:
[Reachability Gramian]
    $W_{r}(t_{0},t_{1})=\int _{t_{0}}^{t_{1}}\phi (t_{1},\tau )B(\tau )B'(\tau )\phi '(t_{1},\tau )d\tau$
The system is reachable if the rank of the reachability gramian is the same as the rank of the system matrix:
    $\operatorname {rank} (W_{r})=p$
<chemistry>/control{range}

### Controllability Gramian

We can define the controllability gramian of a system (A, B) as:
[Controllability Gramian]
    $W_{c}(t_{0},t_{1})=\int _{t_{0}}^{t_{1}}\phi (t_{0},\tau )B(\tau )B'(\tau )\phi '(t_{0},\tau )d\tau$
The system is controllable if the rank of the controllability gramian is the same as the rank of the system matrix:
    $\operatorname {rank} (W_{c})=p$
If the system is time-invariant, there are two important points to be made. First, the reachability gramian and the controllability gramian reduce to be the same equation. Therefore, for LTI systems, if we have found one gramian, then we automatically know both gramians. Second, the controllability gramian can also be found as the solution to the following Lyapunov equation:
    $AW_{c}+W_{c}A'=-BB'$
Many software packages, notably MATLAB, have functions to solve the Lyapunov equation. By using this last relation, we can also solve for the controllability gramian using these existing functions.

## Observability

The state-variables of a system might not be able to be measured for any of the following reasons:
* The location of the particular state variable might not be physically accessible (a capacitor or a spring, for instance).
* There are no appropriate instruments to measure the state variable, or the state-variable might be measured in units for which there does not exist any measurement device.
* The state-variable is a derived "dummy" variable that has no physical meaning.
If things cannot be directly observed, for any of the reasons above, it can be necessary to calculate or estimate the values of the internal state variables, using only the input/output relation of the system, and the output history of the system from the starting time. In other words, we must ask whether or not it is possible to determine what the inside of the system (the internal system states) is like, by only observing the outside performance of the system (input and output)? We can provide the following formal definition of mathematical observability:

### Observability

    A system with an initial state, $x(t_{0})$ is observable if and only if the value of the initial state can be determined from the system output y(t) that has been observed through the time interval $t_{0}<t<t_{f}$. If the initial state cannot be so determined, the system is unobservable.

### Complete Observability

    A system is said to be completely observable if all the possible initial states of the system can be observed. Systems that fail this criteria are said to be unobservable.

### Detectability

    A system is Detectable if all states that cannot be observed decay to zero asymptotically.

### Constructability

    A system is constructable if the present state of the system can be determined from the present and past outputs and inputs to the system. If a system is observable, then it is also constructable. The relationship does not work the other way around.
A system state x$_i$ is unobservable at a given time t$_i$ if the zero-input response of the system is zero for all time t. If a system is observable, then the only state that produces a zero output for all time is the zero state. We can use this concept to define the term state-observability.

### State-Observability

    A system is completely state-observable at time t$_0$ or the pair (A, C) is observable at t$_0$ if the only state that is unobservable at t$_0$ is the zero state x = 0.

### Constructability

A state x is unconstructable at a time t$_1$ if for every finite time t < t$_1$ the zero input response of the system is zero for all time t.
A system is completely state constructable at time t$_1$ if the only state x that is unconstructable at t$_0$ is x = 0.
If a system is observable at an initial time t$_0$, then it is constructable at some time t > t$_0$, if it is constructable at t$_1$.

### Observability Matrix

The observability of the system is dependent only on the system states and the system output, so we can simplify our state equations to remove the input terms:
Matrix Dimensions: A: p × p B: p × q C: r × p D: r × q
    $x'(t)=Ax(t)$
    $y(t)=Cx(t)$
Therefore, we can show that the observability of the system is dependent only on the coefficient matrices A and C. We can show precisely how to determine whether a system is observable, using only these two matrices. If we have the observability matrix Q:
[Observability Matrix]
    $Q={\begin{bmatrix}C\\CA\\CA^{2}\\\vdots \\CA^{p-1}\end{bmatrix}}$
we can show that the system is observable if and only if the Q matrix has a rank of p. Notice that the Q matrix has the dimensions pr × p.
MATLAB allows one to easily create the observability matrix with the obsv command. To create the observability matrix $Q$ simply type
    Q=obsv(A,C)
where A and C are mentioned above. Then in order to determine if the system is observable or not one can use the rank command to determine if it has full rank.

### Observability Gramian

We can define an observability gramian as:
[Observability Gramian]
    $W_{o}(t_{0},t_{1})=\int _{t_{0}}^{t_{1}}\phi '(\tau ,t_{0})C'(\tau )C(\tau )\phi (\tau ,t_{0})d\tau$
A system is completely state observable at time t$_0$ < t < t$_1$ if and only if the rank of the observability gramian is equal to the size p of the system matrix A.
If the system (A, B, C, D) is time-invariant, we can construct the observability gramian as the solution to the Lyapunov equation:
    $A'W_{o}+W_{o}A=-C'C$

### Constructability Gramian

We can define a constructability gramian as:
[Constructability Gramian]
    $W_{cn}(t_{0},t_{1})=\int _{t_{0}}^{t_{1}}\phi '(\tau ,t_{1})C'(\tau )C(\tau )\phi (\tau ,t_{1})d\tau$
A system is completely state observable at an initial time t$_0$ if and only if there exists a finite t$_1$ such that:
    $\operatorname {rank} (W_{0})=\operatorname {rank} (W_{cn})=p$
Notice that the constructability and observability gramians are very similar, and typically they can both be calculated at the same time, only substituting in different values into the state-transition matrix.

## Duality Principle

The concepts of controllability and observability are very similar. In fact, there is a concrete relationship between the two. We can say that a system (A, B) is controllable if and only if the system (A', C, B', D) is observable. This fact can be proven by plugging A' in for A, and B' in for C into the observability Gramian. The resulting equation will exactly mirror the formula for the controllability gramian, implying that the two results are the same.
| ← Nyquist Stability Criteria | Control Systems | System Specifications → |