Part 7 - State Space Realization

State Space Realization

The problem of deriving a linear state space equation from a higher ODE or transfer function is called realization.

we have seen some realization examples from ODEs to the state space equation, we also introduced how to get a transfer function from the state space function.

But now, if we have a transfer function, what is the state space equation?

Given,

P(s)=β(s)α(s)=b0sn+b1sn1++bn1s+bnsn+a1sn1++an1s+anP(s) = \frac{\beta(s)}{\alpha(s)} = \frac{b_0s^n + b_1s^{n - 1} + \ldots + b_{n - 1} s + b_n}{s^n + a_1 s^{n - 1} + \ldots + a_{n - 1} s + a_n}

We want to find n^n,FRn^×n^,GRn^×1,HR1×n^\hat{n} \geq n, F \in \mathbb{R}^{\hat{n} \times \hat{n}}, G \in \mathbb{R}^{\hat{n} \times 1}, H \in \mathbb{R}^{1 \times \hat{n}} and JRJ \in \mathbb{R} such that,

P(s)=H(sIF)1G+JP(s) = H(sI - F)^{-1}G + J

We call the system,

x˙=Fx+Guy=Hx+Ju\begin{aligned} \dot{x} &= Fx + Gu \newline y &= Hx + Ju \end{aligned}

a state space realization of P(s)P(s) or (F,G,H,J)(F, G, H, J) a realization. n^\hat{n} is the dimension of the realization.

From Transfer Function to State Space

Consider the following system which has a simple transfer function,

P(s)=s+2s2+7s+12P(s) = \frac{s + 2}{s^2 + 7s + 12}

Let F=[71210],G=[10],H=[12]F = \begin{bmatrix} -7 & -12 \newline 1 & 0 \end{bmatrix}, G = \begin{bmatrix} 1 \newline 0 \end{bmatrix}, H = \begin{bmatrix} 1 & 2 \end{bmatrix} and J=0J = 0.

Therefore,

[x˙1x˙2]=[71210][x1x2]+[10]uy=[12][x1x2]\begin{aligned} \begin{bmatrix} \dot{x}_1 \newline \dot{x}_2 \end{bmatrix} &= \begin{bmatrix} -7 & -12 \newline 1 & 0 \end{bmatrix} \begin{bmatrix} x_1 \newline x_2 \end{bmatrix} + \begin{bmatrix} 1 \newline 0 \end{bmatrix} u \newline y &= \begin{bmatrix} 1 & 2 \end{bmatrix} \begin{bmatrix} x_1 \newline x_2 \end{bmatrix} \end{aligned}

This is a realization of the transfer function P(s)P(s).

If we observe the solution and our original transfer function, we can see a pattern.

Control Canonical Form Realization

Let,

F=[a1a2an1an100001000010]AcF = \begin{bmatrix} -a_1 & -a_2 & \ldots & -a_{n - 1} & -a_n \newline 1 & 0 & \ldots & 0 & 0 \newline 0 & 1 & \ldots & 0 & 0 \newline \vdots & \vdots & \ddots & \vdots & \vdots \newline 0 & 0 & \ldots & 1 & 0 \end{bmatrix} \triangleq A_c G=[100]Bc,H=[b1b2bn]Cc,J=0DcG = \begin{bmatrix} 1 \newline 0 \newline \vdots \newline 0 \end{bmatrix} \triangleq B_c, H = \begin{bmatrix} b_1 & b_2 & \ldots & b_{n} \end{bmatrix} \triangleq C_c, J = 0 \triangleq D_c Cc(sIAc)1Bc=b1sn1+b2sn2++bnsn+a1sn1++anC_c(sI - A_c)^{-1}B_c = \frac{b_1s^{n - 1} + b_2s^{n - 2} + \ldots + b_n}{s^n + a_1s^{n - 1} + \ldots + a_n}
Companion Matrix

The matrix AcA_c is determined by the coefficients of the polynomial α(s)\alpha(s) and is called the companion matrix of α(s)\alpha(s).

We have a nice property of the companion matrix,

Proposition 1

det(sIAc)=α(s)=sn+a1sn1++an\det(sI - A_c) = \alpha(s) = s^n + a_1s^{n - 1} + \ldots + a_n

Proof

For n=3n = 3:

Ac=[a1a2a3100010]    sIAc=[s+a1a2a31s001s]A_c = \begin{bmatrix} -a_1 & -a_2 & -a_3 \newline 1 & 0 & 0 \newline 0 & 1 & 0 \end{bmatrix} \implies sI - A_c = \begin{bmatrix} s + a_1 & a_2 & a_3 \newline -1 & s & 0 \newline 0 & -1 & s \end{bmatrix}

Thus,

det(sIAc)=(1)s+a1a310+ss+a1a21s=a3+s((s+a1)s+a2)=s3+a1s2+a2s+a3\begin{aligned} \det(sI - A_c) & = -(-1) \begin{vmatrix} s + a_1 & a_3 \newline -1 & 0 \end{vmatrix} + s \begin{vmatrix} s + a_1 & a_2 \newline -1 & s \end{vmatrix} \newline & = a_3 + s((s + a_1)s + a_2) \newline & = s^3 + a_1s^2 + a_2s + a_3 \end{aligned}

Observer Canonical Form Realization

Let,

Ao=AcT=[a1In1an1an01×(n1)]A_o = A_c^T = \begin{bmatrix} -a_1 \newline \vdots & I_{n - 1} \newline -a_{n - 1} \newline -a_n & \mathbf{0}_{1 \times (n - 1)} \end{bmatrix} Bo=CcT=[b1bn],Co=BcT=[100],Do=0B_o = C_c^T = \begin{bmatrix} b_1 \newline \vdots \newline b_n \end{bmatrix}, C_o = B_c^T = \begin{bmatrix} 1 & 0 & \ldots & 0 \end{bmatrix}, D_o = 0

Then,

Co(sIAo)1Bo=P(s)=b1sn1+b2sn2++bnsn+a1sn1++anC_o(sI - A_o)^{-1}B_o = P(s) = \frac{b_1s^{n - 1} + b_2s^{n - 2} + \ldots + b_n}{s^n + a_1s^{n - 1} + \ldots + a_n}

I.e.,

x˙=Aox+Bouy=Cox+Dou\begin{aligned} \dot{x} &= A_o x + B_o u \newline y &= C_o x + D_o u \end{aligned}

is also a realization of P(s)P(s).

Example 1

Let,

P(s)=b1s2+b2s+b3s3+a1s2+a2s+a3P(s) = \frac{b_1 s^2 + b_2 s + b_3}{s^3 + a_1 s^2 + a_2 s + a_3}

Find the control canonical form realization and observer canonical form realization.

Let’s start with control canonical form realization,

Ac=[a1a2a3100010]A_c = \begin{bmatrix} -a_1 & -a_2 & -a_3 \newline 1 & 0 & 0 \newline 0 & 1 & 0 \end{bmatrix}Bc=[100]B_c = \begin{bmatrix} 1 \newline 0 \newline 0 \end{bmatrix}Cc=[b1b2b3]C_c = \begin{bmatrix} b_1 & b_2 & b_3 \end{bmatrix}

For observer canonical form realization,

Ao=AcT=[a110a201a300]A_o = A_c^T = \begin{bmatrix} -a_1 & 1 & 0 \newline -a_2 & 0 & 1 \newline -a_3 & 0 & 0 \end{bmatrix}Bo=CcT=[b1b2b3]B_o = C_c^T = \begin{bmatrix} b_1 \newline b_2 \newline b_3 \end{bmatrix}Co=BcT=[100]C_o = B_c^T = \begin{bmatrix} 1 & 0 & 0 \end{bmatrix}
Remark 1
  1. Nonuniquess of realization, as we have seen previously, the realizations are not unique (we will discuss this shortly).
  2. The dimension of a realization can be any integer greater or equal to nn. If α(s)\alpha(s) and β(s)\beta(s) are coprime, then the minimal dimension of a realization of a transfer function is equal to n.
  3. The transfer function of a state equation is invariant under a state transformation.

What is a Good Realization?

A realization can be viewed as a modeling method of physical system.

Since realizations are not unique, they can be good and bad realizations.

From the control point of view, we need to determine what makes a good realization.

Controllability and observability are two criterions to determine a good realization.

Controllability Matrix & Observability Matrix

The matrix,

[BcAcBcAcn1Bc]\begin{bmatrix} B_c & A_cB_c & \ldots & A_c^{n - 1}B_c \end{bmatrix}

is called the controllability matrix of the system.

The matrix,

[CoCoAoCoAon1]\begin{bmatrix} C_o \newline C_oA_o \newline \vdots \newline C_oA_o^{n - 1} \end{bmatrix}

is called the observability matrix of the system.

NB: The elements of these matrices are matrices, for example,

Let A=[1234]A = \begin{bmatrix} 1 & 2 \newline 3 & 4 \end{bmatrix} and B=[5678]B = \begin{bmatrix} 5 & 6 \newline 7 & 8 \end{bmatrix}, then the matrix [AB][A B] is,

[12563478]\begin{bmatrix} 1 & 2 & 5 & 6 \newline 3 & 4 & 7 & 8 \end{bmatrix}

We are not going into the formal proof, but it can be verified that,

rank[BcAcBcAcn1Bc]=n\text{rank} \begin{bmatrix} B_c & A_cB_c & \ldots & A_c^{n - 1}B_c \end{bmatrix} = n

and

rank[CoCoAoCoAon1]=n\text{rank} \begin{bmatrix} C_o \newline C_oA_o \newline \vdots \newline C_oA_o^{n - 1} \end{bmatrix} = n

Remark

One can always transform a given state description to control canonical form if and only if the controllability matrix is nonsingular (i.e., full rank).

Controllability

From the name, it suggests that, to what extent can the input uu affect the state xx.

Let’s go with this intuition for a moment.

Controllability
Controllability

Let’s say we have two state variables x1x_1 and x2x_2.

The system is described by the following equations,

x1˙=x1,x1(0)x10x2˙=x2+u,x2(0)=x20\begin{aligned} \dot{x_1} & = x_1, x_1(0) x_{10} \newline \dot{x_2} & = x_2 + u, x_2(0) = x_{20} \end{aligned}

Thus, x1x_1 and x2x_2 in the time domain are,

x1(t)=etx10x2(t)=etx20+et0teτu(τ)dτ\begin{aligned} x_1(t) & = e^t x_{10} \newline x_2(t) & = e^t x_{20} + e^t \int_0^t e^{-\tau} u(\tau) d\tau \end{aligned}

No matter how u(t)u(t) is chosen or designed, it cannot affect x1(t)x_1(t).

Note, this doesn’t mean we can specifically design a system as a whole to go from a starting point x0x_0 to a final point xfx_f given the right conditions.

But since this generally doesn’t, hold, meaning we can not go from an arbitrary starting point to an arbitrary final point, we say the system is uncontrollable.

Let’s now properly define controllability.

Definition 1 (Controllability)

The LTI system,

x˙=Fx+Gu,x(0)=0,t0\dot{x} = Fx + Gu, x(0) = 0, t \geq 0

where FRn×nF \in \mathbb{R}^{n \times n} and GRn×1G \in \mathbb{R}^{n \times 1} is controllable on [0,tf][0, t_f] for some tf>0t_f > 0, if given any initial state x0x_0 and final state xfx_f, there exists a pieacewise continuous input u(t)u(t) subject to the solutuion of the system, satifies

x(tf)=xfx(t_f) = x_f
Remark 2

It will be seen later that whether a system is controllable depends on FF and GG, we also say that the pair {F,G}\{F, G\} is controllable or uncontrollable.

Theorem 1 (Criterion for Controllability)

The system is controllable if and only if,

rank[GFGFn1G]=n\text{rank} \begin{bmatrix} G & FG & \ldots & F^{n - 1}G \end{bmatrix} = n
Example 2

Let’s consider the system,

F=[0121],G=[01]F = \begin{bmatrix} 0 & 1 \newline -2 & -1 \end{bmatrix}, G = \begin{bmatrix} 0 \newline 1 \end{bmatrix}

We can see that this system is of order two, so let’s first calculate FGFG.

FG=[11]FG = \begin{bmatrix} 1 \newline -1 \end{bmatrix}

Thus, the controllability matrix is,

[0111]\begin{bmatrix} 0 & 1 \newline 1 & -1 \end{bmatrix}

For matrices of size 2×22 \times 2, we can easily calculate the determinant,

det[0111]=(01)(11)=1\det \begin{bmatrix} 0 & 1 \newline 1 & -1 \end{bmatrix} = (0 \cdot -1) - (1 \cdot 1) = -1

Since the determinant is not zero, the controllability matrix is full rank, and the system is controllable.

On the other hamd, if

F=[1001],G=[01]F = \begin{bmatrix} 1 & 0 \newline 0 & 1 \end{bmatrix}, G = \begin{bmatrix} 0 \newline 1 \end{bmatrix}FG=[01]FG = \begin{bmatrix} 0 \newline 1 \end{bmatrix}

Then, the controllability matrix is,

[0011]\begin{bmatrix} 0 & 0 \newline 1 & 1 \end{bmatrix}

The determinant of this matrix is zero, so the system is uncontrollable.

Recall (Rank of a matrix)

(This is just a refresher, skip if you are already familiar with this)

Let A=[aij]A = [a_{ij}] be a n×mn \times m matrix. If n=mn = m, then AA has full rank if and only if AA is nonsingular if and only if det(A)0\det(A) \neq 0.

If n<mn < m, then A has full rank if and only if AA contains a nonsingular n×nn \times n submatrix. An n×nn \times n submatrix of AA can be obtained from AA by removing any mnm - n columns of AA.

If n>mn > m then AA has full rank if and only if AA contains a nonsingular m×mm \times m submatrix. An m×mm \times m submatrix of AA can be obtained from AA by removing any nmn - m rows of AA.

Observability

Observability is the dual of controllability. It is the extent to which the state xx can be determined from the output yy.

The state xx may not have any physical meaning and may not be measurable. It is desirable to be able to estimate x(t)x(t) from the information of y(t)y(t) and u(t)u(t).

If this is indeed the case, the state x(t)x(t) is said to be observable from the input and output.

Definition 2 (Observability)

The LTI system,

x˙=Fx+Gux(0)=x0y=Hx+Jut0\begin{aligned} \dot{x} & = Fx + Gu \quad x(0) = x_0 \newline y & = Hx + Ju \quad t \geq 0 \end{aligned}

is observable if for any t>0t > 0, x(t)x(t) can be determined from y(t)y(t) and u(t)u(t).

Theorem 2 (Criterion for Observability)

The system is observable if and only if,

rank[HHFHFn1]=n\text{rank} \begin{bmatrix} H \newline HF \newline \vdots \newline HF^{n - 1} \end{bmatrix} = n
Example 3

Let’s consider the system,

F=[002001200],G=[100001],H=[100001]F = \begin{bmatrix} 0 & 0 & 2 \newline 0 & 0 & 1 \newline -2 & 0 & 0 \end{bmatrix}, G = \begin{bmatrix} 1 & 0 \newline 0 & 0 \newline 0 & 1 \end{bmatrix}, H = \begin{bmatrix} 1 & 0 & 0 0 & 0 & 1 \end{bmatrix}

We can see that this system is of order three, so let’s first calculate F2F^2, HFHF, and HF2HF^2.

F2=[400200002]F^2 = \begin{bmatrix} -4 & 0 & 0 \newline -2 & 0 & 0 \newline 0 & 0 & -2 \end{bmatrix}HF=[002200]HF = \begin{bmatrix} 0 & 0 & 2 \newline -2 & 0 & 0 \end{bmatrix}HF2=[400002]HF^2 = \begin{bmatrix} -4 & 0 & 0 \newline 0 & 0 & -2 \end{bmatrix}

Thus, the observability matrix is,

[100001002200400002]\begin{bmatrix} 1 & 0 & 0 \newline 0 & 0 & 1 \newline 0 & 0 & 2 \newline -2 & 0 & 0 \newline -4 & 0 & 0 \newline 0 & 0 & -2 \end{bmatrix}

We can see that we have a zero column in the matrix, which means the columns are not linearly independent which means not full rank, so the system is not observable.

Example 4

Let’s consider the system,

F=[00.110.2],H=[01]F = \begin{bmatrix} 0 & -0.1 \newline 1 & -0.2 \end{bmatrix}, H = \begin{bmatrix} 0 & 1 \end{bmatrix}

We can see that this system is of order two, so let’s first calculate HFHF.

HF=[10.2]HF = \begin{bmatrix} 1 & -0.2 \end{bmatrix}

Thus, the observability matrix is,

[0110.2]\begin{bmatrix} 0 & 1 \newline 1 & -0.2 \end{bmatrix}

Which we can see has a non-zero determinant, so the system is observable.

Properties and Remarks

  1. {Ac,Bc,Cc}\{A_c, B_c, C_c\} is always controllable, but may not be observable. But if Cc(sIAc)1BcC_c(sI - A_c)^{-1} B_c is irreducible, then {Ac,Bc,Cc}\{A_c, B_c, C_c\} is also observable.
  2. {Ao,Bo,Co}\{A_o, B_o, C_o\} is always observable, but may not be controllable. But if Co(sIAo)1BoC_o(sI - A_o)^{-1} B_o is irreducible, then {Ao,Bo,Co}\{A_o, B_o, C_o\} is also controllable.
  3. Define C(F,G)=[GFGFn1G]C(F, G) = \begin{bmatrix} G & FG & \ldots & F^{n - 1}G \end{bmatrix} and call it the controllability matrix, and O(H,F)=[HHFHFn1]O(H, F) = \begin{bmatrix} H \newline HF \newline \vdots \newline HF^{n - 1} \end{bmatrix} and call it the observability matrix.