OBSV
This function builds the observability matrix for a linear state-space system with state matrix A and output matrix C.
\mathcal{O} = \begin{bmatrix} C \\ C A \\ C A^2 \\ \vdots \\ C A^{n-1} \end{bmatrix}
A system is observable when this matrix has full rank, meaning the internal state can be reconstructed from output measurements over finite time. The matrix is commonly used when checking whether observer design or state estimation is feasible.
Excel Usage
=OBSV(A, C)
A(list[list], required): State dynamics matrix A.C(list[list], required): Output matrix C.
Returns (list[list]): The observability matrix.
Example 1: Observability of a second order system
Inputs:
| A | C | ||
|---|---|---|---|
| 0 | 1 | 1 | 0 |
| -2 | -3 |
Excel formula:
=OBSV({0,1;-2,-3}, {1,0})
Expected output:
| Result | |
|---|---|
| 1 | 0 |
| 0 | 1 |
Example 2: Single-state observability matrix
Inputs:
| A | C |
|---|---|
| 2 | 3 |
Excel formula:
=OBSV({2}, {3})
Expected output:
3
Example 3: Two-state system with two output channels
Inputs:
| A | C | ||
|---|---|---|---|
| 1 | 0 | 1 | 0 |
| 0 | 2 | 0 | 1 |
Excel formula:
=OBSV({1,0;0,2}, {1,0;0,1})
Expected output:
| Result | |
|---|---|
| 1 | 0 |
| 0 | 1 |
| 1 | 0 |
| 0 | 2 |
Example 4: Double integrator observability matrix
Inputs:
| A | C | ||
|---|---|---|---|
| 0 | 1 | 1 | 0 |
| 0 | 0 |
Excel formula:
=OBSV({0,1;0,0}, {1,0})
Expected output:
| Result | |
|---|---|
| 1 | 0 |
| 0 | 1 |
Python Code
Show Code
import control as ct
import numpy as np
def obsv(A, C):
"""
Compute the observability matrix.
See: https://python-control.readthedocs.io/en/latest/generated/control.obsv.html
This example function is provided as-is without any representation of accuracy.
Args:
A (list[list]): State dynamics matrix A.
C (list[list]): Output matrix C.
Returns:
list[list]: The observability matrix.
"""
try:
def to_np(x):
if x is None:
return None
if not isinstance(x, list):
return np.array([[float(x)]])
if x and not isinstance(x[0], list):
x = [x]
return np.array([[float(v) if v is not None and str(v) != "" else 0.0 for v in row] for row in x])
a_np = to_np(A)
c_np = to_np(C)
O = ct.obsv(a_np, c_np)
return O.tolist()
except Exception as e:
return f"Error: {str(e)}"Online Calculator
State dynamics matrix A.
Output matrix C.