Chapter 8: State-Space Modeling
Lesson 3: Canonical Forms: Controllable, Observable, and Diagonal Forms
This lesson develops canonical (standard) state-space realizations for linear time-invariant (LTI) systems: the controllable canonical form, observable canonical form, and diagonal (modal) form. We focus on (i) how these forms are constructed, (ii) why they are equivalent descriptions of the same input–output behavior (via similarity transformations), and (iii) what structural insights each form provides for analysis and simulation. Implementations are provided in Python, C++, Java, MATLAB/Simulink, and Wolfram Mathematica.
1. Prerequisites and Scope
From Lessons 1–2, we use the continuous-time LTI state-space model \( \dot{\mathbf{x}}(t) = \mathbf{A}\mathbf{x}(t) + \mathbf{B}\mathbf{u}(t) \), \( \mathbf{y}(t) = \mathbf{C}\mathbf{x}(t) + \mathbf{D}\mathbf{u}(t) \), where \( \mathbf{x}\in\mathbb{R}^n \), \( \mathbf{u}\in\mathbb{R}^m \), and \( \mathbf{y}\in\mathbb{R}^p \).
This lesson emphasizes SISO canonical forms (\( m=p=1 \)) because they admit clean closed-form constructions from transfer functions. Extensions to MIMO exist, but require additional algebraic structure (minimal realizations, invariant zeros, etc.), which we defer.
2. Why Canonical Forms?
A canonical form is a structured state-space realization chosen to make some property transparent:
- Controllable canonical form: highlights how the input propagates through an “integrator chain” into the state.
- Observable canonical form: highlights how the output “sees” internal state components.
- Diagonal (modal) form: decouples the dynamics into independent modes when the state matrix is diagonalizable.
These are not different physical systems; they are different coordinate descriptions related by invertible state transformations. The key invariant is the input–output mapping, summarized (for SISO) by the transfer function \( G(s) = \frac{Y(s)}{U(s)} \) under zero initial conditions.
flowchart TD
A["Start: given G(s) or (A,B,C,D)"] --> B["Choose goal: structure you want"]
B --> C1["Goal: input-propagation clarity"]
B --> C2["Goal: output-sensing clarity"]
B --> C3["Goal: decouple modes \n(if possible)"]
C1 --> D1["Build controllable canonical \n(companion) form"]
C2 --> D2["Build observable canonical \n(dual companion) form"]
C3 --> D3["Eigen-decompose A \n(diagonalizable?)"]
D3 --> E3["If yes: modal form; \nelse: keep real block/Jordan idea \n(not expanded here)"]
D1 --> F["Verify invariants: \nsame G(s), same poles"]
D2 --> F
E3 --> F
In this chapter we treat canonical forms as a modeling and analysis tool: a way to standardize realizations and reveal structural properties.
3. Similarity Transformations Preserve Input–Output Behavior
Let \( \mathbf{T}\in\mathbb{R}^{n\times n} \) be invertible, and define a new state coordinate \( \mathbf{x}(t) = \mathbf{T}\mathbf{z}(t) \). Then:
\[ \dot{\mathbf{x}} = \mathbf{A}\mathbf{x} + \mathbf{B}\mathbf{u} \;\;\Longrightarrow\;\; \mathbf{T}\dot{\mathbf{z}} = \mathbf{A}\mathbf{T}\mathbf{z} + \mathbf{B}\mathbf{u} \;\;\Longrightarrow\;\; \dot{\mathbf{z}} = \underbrace{\mathbf{T}^{-1}\mathbf{A}\mathbf{T}}_{\tilde{\mathbf{A}}}\mathbf{z} + \underbrace{\mathbf{T}^{-1}\mathbf{B}}_{\tilde{\mathbf{B}}}\mathbf{u}. \]
For the output equation:
\[ \mathbf{y} = \mathbf{C}\mathbf{x} + \mathbf{D}\mathbf{u} = \mathbf{C}\mathbf{T}\mathbf{z} + \mathbf{D}\mathbf{u} \;\;\Longrightarrow\;\; \mathbf{y} = \underbrace{\mathbf{C}\mathbf{T}}_{\tilde{\mathbf{C}}}\mathbf{z} + \mathbf{D}\mathbf{u}. \]
Theorem (transfer-function invariance under similarity): For any invertible \( \mathbf{T} \), the transfer function computed from \( (\mathbf{A},\mathbf{B},\mathbf{C},\mathbf{D}) \) equals that computed from \( (\tilde{\mathbf{A}},\tilde{\mathbf{B}},\tilde{\mathbf{C}},\mathbf{D}) \).
Proof: The (SISO/MIMO) transfer function matrix is \( \mathbf{G}(s) = \mathbf{C}(s\mathbf{I}-\mathbf{A})^{-1}\mathbf{B} + \mathbf{D} \). It suffices to show \( \tilde{\mathbf{C}}(s\mathbf{I}-\tilde{\mathbf{A}})^{-1}\tilde{\mathbf{B}} = \mathbf{C}(s\mathbf{I}-\mathbf{A})^{-1}\mathbf{B} \).
Note the identity (for invertible \( \mathbf{T} \)):
\[ s\mathbf{I}-\tilde{\mathbf{A}} = s\mathbf{I}-\mathbf{T}^{-1}\mathbf{A}\mathbf{T} = \mathbf{T}^{-1}(s\mathbf{I}-\mathbf{A})\mathbf{T} \;\;\Longrightarrow\;\; (s\mathbf{I}-\tilde{\mathbf{A}})^{-1} = \mathbf{T}^{-1}(s\mathbf{I}-\mathbf{A})^{-1}\mathbf{T}. \]
Therefore,
\[ \tilde{\mathbf{C}}(s\mathbf{I}-\tilde{\mathbf{A}})^{-1}\tilde{\mathbf{B}} = (\mathbf{C}\mathbf{T})\left(\mathbf{T}^{-1}(s\mathbf{I}-\mathbf{A})^{-1}\mathbf{T}\right)(\mathbf{T}^{-1}\mathbf{B}) = \mathbf{C}(s\mathbf{I}-\mathbf{A})^{-1}\mathbf{B}. \]
Adding the common direct term \( \mathbf{D} \) completes the proof. \(\blacksquare\)
Canonical forms are thus best understood as coordinate choices (state bases) that impose a useful structure on \( \mathbf{A},\mathbf{B},\mathbf{C} \) without altering input–output behavior.
4. Controllable Canonical Form (SISO Companion Form)
Consider a SISO transfer function (proper, with possible feedthrough):
\[ G(s) = \frac{b_{n-1}s^{n-1} + b_{n-2}s^{n-2} + \cdots + b_1 s + b_0}{s^n + a_{n-1}s^{n-1} + \cdots + a_1 s + a_0} + d, \]
where the denominator is monic (leading coefficient 1). The controllable canonical form realization is:
\[ \mathbf{A}_c = \begin{bmatrix} 0 & 1 & 0 & \cdots & 0 \\ 0 & 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & 1 \\ -a_0 & -a_1 & -a_2 & \cdots & -a_{n-1} \end{bmatrix},\quad \mathbf{B}_c = \begin{bmatrix} 0 \\ 0 \\ \vdots \\ 0 \\ 1 \end{bmatrix},\\ \mathbf{C}_c = \begin{bmatrix} b_0 & b_1 & b_2 & \cdots & b_{n-1} \end{bmatrix},\quad \mathbf{D} = d. \]
The structure \( \dot{x}_1 = x_2, \dot{x}_2 = x_3, \ldots, \dot{x}_{n-1}=x_n \) is an integrator chain, and the last equation \( \dot{x}_n = -\sum_{k=0}^{n-1} a_k x_{k+1} + u \) closes the loop with the denominator coefficients.
Proposition (realization matches \(G(s)\)): The transfer function of \( (\mathbf{A}_c,\mathbf{B}_c,\mathbf{C}_c,d) \) equals the rational function above.
Proof (construct \( (s\mathbf{I}-\mathbf{A}_c)^{-1}\mathbf{B}_c \) explicitly): Let \( \mathbf{v}(s) = (s\mathbf{I}-\mathbf{A}_c)^{-1}\mathbf{B}_c \), i.e. solve \( (s\mathbf{I}-\mathbf{A}_c)\mathbf{v} = \mathbf{B}_c \). Write \( \mathbf{v} = [v_1,\ldots,v_n]^T \). The first \( n-1 \) rows yield:
\[ sv_1 - v_2 = 0,\;\; sv_2 - v_3 = 0,\;\; \ldots,\;\; sv_{n-1} - v_n = 0 \;\;\Longrightarrow\;\; v_k = s^{k-1}v_1,\;\; k=1,\ldots,n. \]
The last row of \( s\mathbf{I}-\mathbf{A}_c \) gives:
\[ a_0 v_1 + a_1 v_2 + \cdots + a_{n-2}v_{n-1} + (s+a_{n-1})v_n = 1. \]
Substitute \( v_k = s^{k-1}v_1 \):
\[ \left(a_0 + a_1 s + \cdots + a_{n-1}s^{n-1} + s^n\right)v_1 = 1 \;\;\Longrightarrow\;\; v_1 = \frac{1}{s^n + a_{n-1}s^{n-1} + \cdots + a_0}. \]
Hence \( v_k = \frac{s^{k-1}}{s^n + a_{n-1}s^{n-1} + \cdots + a_0} \) and therefore
\[ \mathbf{C}_c\mathbf{v} = \frac{b_0 + b_1 s + \cdots + b_{n-1}s^{n-1}}{s^n + a_{n-1}s^{n-1} + \cdots + a_0}. \]
Adding \( d \) gives exactly \( G(s) \). \(\blacksquare\)
Controllability (introduced here as a modeling property): A pair \( (\mathbf{A},\mathbf{B}) \) is called controllable if, informally, the input can move the state throughout the state space (precise definitions are developed later; here we use the standard rank condition). Define the controllability matrix: \( \mathcal{C} = [\mathbf{B},\mathbf{A}\mathbf{B},\ldots,\mathbf{A}^{n-1}\mathbf{B}] \).
Proposition: The controllable canonical pair \( (\mathbf{A}_c,\mathbf{B}_c) \) satisfies \( \operatorname{rank}(\mathcal{C})=n \).
Proof (structure of Krylov columns): For \( \mathbf{B}_c = [0,\ldots,0,1]^T \), the vectors \( \mathbf{A}_c^k\mathbf{B}_c \) shift “mass” upward with nonzero components that form a full basis. More concretely, one can show that the controllability matrix is lower triangular (up to a column permutation) with ones on the diagonal, hence full rank. Therefore \( \det(\mathcal{C}) \neq 0 \) and \( \operatorname{rank}(\mathcal{C})=n \). \(\blacksquare\)
5. Observable Canonical Form (SISO Dual Companion Form)
The observable canonical form is the “dual” structured realization that emphasizes how the output depends on successive state components. For the same transfer function coefficients, one convenient observable canonical realization is:
\[ \mathbf{A}_o = \begin{bmatrix} 0 & 0 & 0 & \cdots & -a_0 \\ 1 & 0 & 0 & \cdots & -a_1 \\ 0 & 1 & 0 & \cdots & -a_2 \\ \vdots & \vdots & \ddots & \ddots & \vdots \\ 0 & 0 & \cdots & 1 & -a_{n-1} \end{bmatrix},\quad \mathbf{B}_o = \begin{bmatrix} b_0 \\ b_1 \\ b_2 \\ \vdots \\ b_{n-1} \end{bmatrix},\quad \mathbf{C}_o = \begin{bmatrix} 1 & 0 & 0 & \cdots & 0 \end{bmatrix},\quad \mathbf{D}=d. \]
This form can be obtained by a duality argument: for SISO, a standard observable canonical realization is essentially the transpose of a controllable canonical realization of the “dual” system, which motivates the structural relationship: \( \mathbf{A}_o = \mathbf{A}_c^T \), \( \mathbf{B}_o = \mathbf{C}_c^T \), \( \mathbf{C}_o = \mathbf{B}_c^T \) (up to conventions on coefficient ordering).
Observability (introduced here as a modeling property): A pair \( (\mathbf{A},\mathbf{C}) \) is called observable if, informally, the internal state can be inferred from output measurements over time. Define the observability matrix: \( \mathcal{O} = [\mathbf{C}^T, (\mathbf{C}\mathbf{A})^T,\ldots,(\mathbf{C}\mathbf{A}^{n-1})^T]^T \).
Proposition: The observable canonical pair \( (\mathbf{A}_o,\mathbf{C}_o) \) satisfies \( \operatorname{rank}(\mathcal{O})=n \).
Proof (mirror of the controllable case): With \( \mathbf{C}_o = [1,0,\ldots,0] \), successive products \( \mathbf{C}_o\mathbf{A}_o^k \) pick out structured rows that generate a full basis of row space. One can show \( \mathcal{O} \) is upper triangular (up to row permutation) with ones on the diagonal, hence full rank. \(\blacksquare\)
6. Diagonal (Modal) Form and Decoupled Modes
The diagonal (modal) form is built from the eigen-structure of the state matrix \( \mathbf{A} \). Assume \( \mathbf{A} \) is diagonalizable: there exists an invertible matrix of eigenvectors \( \mathbf{V}=[\mathbf{v}_1,\ldots,\mathbf{v}_n] \) such that \( \mathbf{A}\mathbf{V}=\mathbf{V}\boldsymbol{\Lambda} \), where \( \boldsymbol{\Lambda}=\operatorname{diag}(\lambda_1,\ldots,\lambda_n) \).
\[ \mathbf{A} = \mathbf{V}\boldsymbol{\Lambda}\mathbf{V}^{-1},\quad \mathbf{x} = \mathbf{V}\mathbf{z} \;\;\Longrightarrow\;\; \dot{\mathbf{z}} = \boldsymbol{\Lambda}\mathbf{z} + \underbrace{\mathbf{V}^{-1}\mathbf{B}}_{\mathbf{B}_m}u,\quad y = \underbrace{\mathbf{C}\mathbf{V}}_{\mathbf{C}_m}\mathbf{z} + du. \]
Proposition (modal decoupling): In modal coordinates, each state component \( z_i \) evolves as a first-order subsystem:
\[ \dot{z}_i(t) = \lambda_i z_i(t) + b_{m,i}u(t),\quad y(t) = \sum_{i=1}^{n} c_{m,i}z_i(t) + du(t), \]
where \( b_{m,i} \) is the \( i \)-th entry of \( \mathbf{B}_m \) and \( c_{m,i} \) is the \( i \)-th entry of \( \mathbf{C}_m \) (SISO).
Proof: Since \( \boldsymbol{\Lambda} \) is diagonal, the vector equation \( \dot{\mathbf{z}} = \boldsymbol{\Lambda}\mathbf{z} + \mathbf{B}_m u \) is componentwise, yielding the scalar equations above. \(\blacksquare\)
This form provides immediate insight into the natural modes \( e^{\lambda_i t} \) that appear in the homogeneous solution. When \( \lambda_i \) are complex, real-valued implementations typically use real 2×2 blocks (real modal form), which is conceptually the same decoupling but in real coordinates.
7. Practical Construction Recipes (What You Actually Compute)
In this course sequence, you will most often build canonical forms in one of two ways:
- From transfer function coefficients \( \{a_k\},\{b_k\},d \) (SISO): directly assemble \( \mathbf{A}_c,\mathbf{B}_c,\mathbf{C}_c \) or \( \mathbf{A}_o,\mathbf{B}_o,\mathbf{C}_o \).
- From an existing state-space model \( (\mathbf{A},\mathbf{B},\mathbf{C}) \): compute a similarity transformation to a structured basis (eigenvector basis for modal form; controllability/observability Krylov bases for companion-like structures).
Numerical note: canonical forms are algebraically exact, but numerically sensitive when coefficients are ill-conditioned or eigenvalues are clustered. Modal (diagonal) forms can be particularly sensitive if \( \mathbf{V} \) is ill-conditioned (large \( \kappa(\mathbf{V}) \)).
8. Implementations
We implement: (i) controllable canonical matrices from polynomial coefficients, (ii) observable canonical matrices, and (iii) modal form via eigen-decomposition. We also verify equivalence by comparing transfer functions computed as \( C(sI-A)^{-1}B + D \) (symbolically or numerically).
8.1 Python (NumPy/SciPy + python-control)
import numpy as np
from numpy.linalg import inv, eig
def controllable_canonical(a, b, d=0.0):
"""
a: [a0, a1, ..., a_{n-1}] for denominator s^n + a_{n-1}s^{n-1}+...+a0
b: [b0, b1, ..., b_{n-1}] for numerator b_{n-1}s^{n-1}+...+b0
"""
a = np.asarray(a, dtype=float)
b = np.asarray(b, dtype=float)
n = a.size
A = np.zeros((n, n))
A[:-1, 1:] = np.eye(n-1)
A[-1, :] = -a
B = np.zeros((n, 1))
B[-1, 0] = 1.0
C = b.reshape(1, n)
D = np.array([[float(d)]])
return A, B, C, D
def observable_canonical(a, b, d=0.0):
a = np.asarray(a, dtype=float)
b = np.asarray(b, dtype=float)
n = a.size
A = np.zeros((n, n))
A[1:, :-1] = np.eye(n-1)
A[:, -1] = -a
B = b.reshape(n, 1)
C = np.zeros((1, n))
C[0, 0] = 1.0
D = np.array([[float(d)]])
return A, B, C, D
def modal_form(A, B, C):
# Diagonalize A (if possible)
w, V = eig(A)
Vinv = inv(V)
Lambda = np.diag(w)
Bm = Vinv @ B
Cm = C @ V
return Lambda, Bm, Cm, V
def G_eval(A, B, C, D, s):
I = np.eye(A.shape[0])
return (C @ inv(s*I - A) @ B + D).item()
# Example: G(s) = (2s^2 + 3s + 1) / (s^3 + 4s^2 + 5s + 2)
a = [2, 5, 4] # [a0,a1,a2] corresponds to s^3 + a2 s^2 + a1 s + a0
b = [1, 3, 2] # [b0,b1,b2] corresponds to b2 s^2 + b1 s + b0
A1,B1,C1,D1 = controllable_canonical(a,b,d=0.0)
A2,B2,C2,D2 = observable_canonical(a,b,d=0.0)
for s in [1+0j, 2+0j, 1j]:
g1 = G_eval(A1,B1,C1,D1,s)
g2 = G_eval(A2,B2,C2,D2,s)
print(s, g1, g2, "diff=", abs(g1-g2))
# Modal form (requires diagonalizable A1)
Lambda, Bm, Cm, V = modal_form(A1, B1, C1)
print("Eigenvalues:", np.diag(Lambda))
Libraries commonly used in control/system dynamics workflows: NumPy (linear algebra), SciPy (ODE solvers, signal tools), and python-control (state-space/transfer-function utilities). The explicit constructions above avoid reliance on any one convention in conversion routines.
8.2 C++ (Eigen + optional Boost::odeint)
#include <iostream>
#include <Eigen/Dense>
using Eigen::MatrixXd;
using Eigen::VectorXd;
struct SS {
MatrixXd A;
VectorXd B;
VectorXd C;
double D;
};
SS controllableCanonical(const VectorXd& a, const VectorXd& b, double d=0.0) {
int n = (int)a.size();
SS sys;
sys.A = MatrixXd::Zero(n,n);
for(int i=0;i<n-1;i++) sys.A(i,i+1) = 1.0;
sys.A.row(n-1) = -a.transpose();
sys.B = VectorXd::Zero(n);
sys.B(n-1) = 1.0;
sys.C = b;
sys.D = d;
return sys;
}
std::complex<double> G_eval(const SS& sys, std::complex<double> s) {
int n = (int)sys.A.rows();
Eigen::MatrixXcd I = Eigen::MatrixXcd::Identity(n,n);
Eigen::MatrixXcd Ac = sys.A.cast<std::complex<double> >();
Eigen::VectorXcd Bc = sys.B.cast<std::complex<double> >();
Eigen::RowVectorXcd Cc = sys.C.transpose().cast<std::complex<double> >();
Eigen::MatrixXcd M = s*I - Ac;
Eigen::VectorXcd v = M.fullPivLu().solve(Bc);
std::complex<double> val = (Cc * v)(0,0) + sys.D;
return val;
}
int main() {
// Example: G(s)=(2 s^2 + 3 s + 1)/(s^3 + 4 s^2 + 5 s + 2)
VectorXd a(3); a << 2,5,4; // [a0,a1,a2]
VectorXd b(3); b << 1,3,2; // [b0,b1,b2]
SS sys = controllableCanonical(a,b,0.0);
std::complex<double> s1(1.0,0.0);
std::cout << "G(1)=" << G_eval(sys,s1) << std::endl;
// Modal form (eigendecomposition)
Eigen::EigenSolver<MatrixXd> es(sys.A);
std::cout << "Eigenvalues:\n" << es.eigenvalues() << std::endl;
return 0;
}
Typical libraries for “system dynamics” computations in C++ are Eigen (matrix computations) and Boost::odeint (time integration of ODEs). Here we focus on algebraic construction and frequency-domain verification.
8.3 Java (EJML or Apache Commons Math)
import org.ejml.data.DMatrixRMaj;
import org.ejml.dense.row.CommonOps_DDRM;
import org.ejml.dense.row.SpecializedOps_DDRM;
public class CanonicalForms {
static class SS {
DMatrixRMaj A, B, C;
double D;
}
// a=[a0,a1,...,a_{n-1}], b=[b0,b1,...,b_{n-1}]
static SS controllableCanonical(double[] a, double[] b, double d) {
int n = a.length;
SS sys = new SS();
sys.A = new DMatrixRMaj(n,n);
sys.B = new DMatrixRMaj(n,1);
sys.C = new DMatrixRMaj(1,n);
sys.D = d;
// superdiagonal ones
for(int i=0;i<n-1;i++) sys.A.set(i,i+1,1.0);
// last row = -a
for(int j=0;j<n;j++) sys.A.set(n-1,j,-a[j]);
// B = e_n
sys.B.set(n-1,0,1.0);
// C = [b0 ... b_{n-1}]
for(int j=0;j<n;j++) sys.C.set(0,j,b[j]);
return sys;
}
public static void main(String[] args) {
double[] a = {2,5,4};
double[] b = {1,3,2};
SS sys = controllableCanonical(a,b,0.0);
System.out.println("A=");
sys.A.print();
}
}
In Java, EJML and Apache Commons Math are common for linear algebra and eigenvalue computations. The snippet shows canonical assembly; frequency-response verification can be implemented by solving \( (sI-A)^{-1}B \) for complex \( s \) (Commons Math provides complex arithmetic utilities).
8.4 MATLAB and Simulink (Control System Toolbox)
% Example: G(s) = (2 s^2 + 3 s + 1)/(s^3 + 4 s^2 + 5 s + 2)
num = [2 3 1];
den = [1 4 5 2];
d = 0;
% Controllable canonical realization (MATLAB convention)
[A,B,C,D] = tf2ss(num,den);
sys_c = ss(A,B,C,D);
% Observable canonical via canonical transformation (if available)
% 'canon' supports several canonical forms depending on toolbox version.
try
sys_o = canon(sys_c,'companion'); % often returns companion-like form
catch
sys_o = sys_c; % fallback if not supported
end
% Modal (diagonal) form if diagonalizable (uses eig)
[V,Lambda] = eig(A);
Bm = V\B;
Cm = C*V;
disp('A (tf2ss) ='); disp(A);
disp('Eigenvalues ='); disp(diag(Lambda));
% Verify at a few frequencies s=jw
w = [0.5 1 2];
for k=1:length(w)
s = 1j*w(k);
G1 = C*((s*eye(size(A))-A)\B) + D;
fprintf('w=%g, G(jw)=%g%+gj\n', w(k), real(G1), imag(G1));
end
Simulink workflow (conceptual): build a State-Space block with matrices \( A,B,C,D \). For the controllable canonical form, the block directly represents the integrator-chain structure implied by the companion matrix. Programmatic construction is also possible:
% Programmatic Simulink model sketch (requires Simulink)
model = 'canonical_ss_demo';
new_system(model); open_system(model);
add_block('simulink/Continuous/State-Space',[model '/StateSpace']);
set_param([model '/StateSpace'],'A','A','B','B','C','C','D','D');
add_block('simulink/Sources/Step',[model '/Step']);
add_block('simulink/Sinks/Scope',[model '/Scope']);
add_line(model,'Step/1','StateSpace/1');
add_line(model,'StateSpace/1','Scope/1');
set_param(model,'StopTime','10');
save_system(model);
8.5 Wolfram Mathematica (from scratch construction)
(* Canonical form construction from coefficients *)
controllableCanonical[a_List, b_List, d_:0] := Module[{n, A, B, C, D},
n = Length[a];
A = ConstantArray[0, {n, n}];
Do[A[[i, i + 1]] = 1, {i, 1, n - 1}];
A[[n, ;;]] = -a;
B = ConstantArray[0, {n, 1}]; B[[n, 1]] = 1;
C = {b};
D = {{d}};
{A, B, C, D}
];
GfromSS[A_, B_, C_, D_, s_] := (C . Inverse[s IdentityMatrix[Length[A]] - A] . B + D)[[1,1]];
a = {2,5,4}; (* [a0,a1,a2] *)
b = {1,3,2}; (* [b0,b1,b2] *)
{A,Bmat,C,D} = controllableCanonical[a,b,0];
(* Verify transfer function values *)
Table[{s, Simplify[GfromSS[A,Bmat,C,D,s]]}, {s, {1, 2, I}}]
(* Modal form *)
{vals, vecs} = Eigensystem[A];
Lambda = DiagonalMatrix[vals];
V = Transpose[vecs];
Bm = Inverse[V].Bmat;
Cm = C.V;
9. Problems and Solutions
Problem 1 (Build controllable canonical form): Let \( G(s)=\frac{4s^2+2s+3}{s^3+6s^2+11s+6} \) (strictly proper, so \( d=0 \)). Construct \( \mathbf{A}_c,\mathbf{B}_c,\mathbf{C}_c \).
Solution: Here \( n=3 \), and the monic denominator is \( s^3 + a_2 s^2 + a_1 s + a_0 \) with \( a_2=6,a_1=11,a_0=6 \). The numerator is \( b_2 s^2 + b_1 s + b_0 \) with \( b_2=4,b_1=2,b_0=3 \).
\[ \mathbf{A}_c = \begin{bmatrix} 0 & 1 & 0\\ 0 & 0 & 1\\ -6 & -11 & -6 \end{bmatrix},\quad \mathbf{B}_c = \begin{bmatrix} 0\\0\\1 \end{bmatrix},\quad \mathbf{C}_c = \begin{bmatrix} 3 & 2 & 4 \end{bmatrix},\quad \mathbf{D}=0. \]
Problem 2 (Verify realization equals \(G(s)\)): Using the matrices from Problem 1, show that \( \mathbf{C}_c(s\mathbf{I}-\mathbf{A}_c)^{-1}\mathbf{B}_c = \frac{4s^2+2s+3}{s^3+6s^2+11s+6} \).
Solution: Repeat the proof method in Section 4: solve \( (s\mathbf{I}-\mathbf{A}_c)\mathbf{v}=\mathbf{B}_c \). The shift equations imply \( v_2=sv_1 \), \( v_3=s^2 v_1 \), and the last equation yields \( (s^3+6s^2+11s+6)v_1=1 \), hence \( v_1=\frac{1}{s^3+6s^2+11s+6} \). Therefore, \( \mathbf{C}_c\mathbf{v}=\frac{3+2s+4s^2}{s^3+6s^2+11s+6} \), matching \( G(s) \).
Problem 3 (Build observable canonical form): For the same \( G(s) \) in Problem 1, construct one observable canonical realization \( (\mathbf{A}_o,\mathbf{B}_o,\mathbf{C}_o,\mathbf{D}) \) consistent with Section 5.
Solution: Using \( a=[a_0,a_1,a_2]=[6,11,6] \) and \( b=[b_0,b_1,b_2]=[3,2,4] \):
\[ \mathbf{A}_o = \begin{bmatrix} 0 & 0 & -6\\ 1 & 0 & -11\\ 0 & 1 & -6 \end{bmatrix},\quad \mathbf{B}_o = \begin{bmatrix} 3\\2\\4 \end{bmatrix},\quad \mathbf{C}_o = \begin{bmatrix} 1 & 0 & 0 \end{bmatrix},\quad \mathbf{D}=0. \]
One may verify \( \mathbf{C}_o(s\mathbf{I}-\mathbf{A}_o)^{-1}\mathbf{B}_o \) equals the same rational function.
Problem 4 (Modal form for a diagonalizable \(A\)): Let \( \mathbf{A}=\begin{bmatrix}-1 & 0\\ 2 & -3\end{bmatrix} \), \( \mathbf{B}=\begin{bmatrix}1\\0\end{bmatrix} \), \( \mathbf{C}=\begin{bmatrix}0 & 1\end{bmatrix} \). Find a modal realization (diagonal form) and write the decoupled state equations.
Solution: Compute eigenvalues: \( \lambda_1=-1 \), \( \lambda_2=-3 \) (distinct, hence diagonalizable). Eigenvectors can be chosen as \( \mathbf{v}_1=[1,1]^T \) for \( \lambda_1 \) and \( \mathbf{v}_2=[0,1]^T \) for \( \lambda_2 \). Let \( \mathbf{V}=[\mathbf{v}_1,\mathbf{v}_2]=\begin{bmatrix}1&0\\1&1\end{bmatrix} \). Then \( \boldsymbol{\Lambda}=\operatorname{diag}(-1,-3) \), \( \mathbf{B}_m=\mathbf{V}^{-1}\mathbf{B} \), \( \mathbf{C}_m=\mathbf{C}\mathbf{V} \).
\[ \mathbf{V}^{-1}=\begin{bmatrix}1&0\\-1&1\end{bmatrix},\quad \mathbf{B}_m=\begin{bmatrix}1\\-1\end{bmatrix},\quad \mathbf{C}_m=\begin{bmatrix}1 & 1\end{bmatrix}. \]
Thus the modal-coordinate system \( \mathbf{x}=\mathbf{V}\mathbf{z} \) is:
\[ \dot{z}_1 = -z_1 + 1\cdot u,\quad \dot{z}_2 = -3z_2 - 1\cdot u,\quad y = z_1 + z_2. \]
Problem 5 (Similarity invariance check): Let \( \mathbf{x}=\mathbf{T}\mathbf{z} \) with invertible \( \mathbf{T} \). Show directly that \( \det(s\mathbf{I}-\tilde{\mathbf{A}})=\det(s\mathbf{I}-\mathbf{A}) \).
Solution: Using \( \tilde{\mathbf{A}}=\mathbf{T}^{-1}\mathbf{A}\mathbf{T} \),
\[ \det(s\mathbf{I}-\tilde{\mathbf{A}}) = \det\!\left(s\mathbf{I}-\mathbf{T}^{-1}\mathbf{A}\mathbf{T}\right) = \det\!\left(\mathbf{T}^{-1}(s\mathbf{I}-\mathbf{A})\mathbf{T}\right) = \\ \det(\mathbf{T}^{-1})\det(s\mathbf{I}-\mathbf{A})\det(\mathbf{T}) = \det(s\mathbf{I}-\mathbf{A}), \]
since \( \det(\mathbf{T}^{-1})\det(\mathbf{T})=1 \). Therefore similarity preserves the characteristic polynomial and hence the poles.
10. Summary
We constructed three canonical realizations for LTI state-space models. The controllable and observable canonical forms provide structured companion matrices directly from transfer-function coefficients, and the diagonal (modal) form decouples dynamics when the state matrix is diagonalizable. The unifying principle is similarity transformation: canonical forms are coordinate choices that preserve input–output behavior and pole structure.
11. References
- Kalman, R.E. (1960). On the general theory of control systems. Proceedings of the First International Conference on Automatic Control, 481–492.
- Kalman, R.E. (1963). Mathematical description of linear dynamical systems. SIAM Journal on Control, 1(2), 152–192.
- Gilbert, E.G. (1963). Controllability and observability in multivariable control systems. Journal of the Society for Industrial and Applied Mathematics, Series A: Control, 1(2), 128–151.
- Luenberger, D.G. (1964). Observing the state of a linear system. IEEE Transactions on Military Electronics, 8(2), 74–80.
- Rosenbrock, H.H. (1970). State-space and multivariable theory (early foundational papers on realization and canonical structure). IEE/Control Theory literature.
- Ho, B.L., & Kalman, R.E. (1966). Effective construction of linear state-variable models from input/output functions. Automatica, 2(4), 545–548.
- Silverman, L.M. (1971). Realization of linear dynamical systems. IEEE Transactions on Automatic Control, 16(6), 554–567.
- Kailath, T. (1980). Linear systems: canonical forms and realization theory (associated foundational journal developments). IEEE control/estimation literature.