6. Linear state space systems (MIMO)#

6.1. Usefull vector-matrix methods#

Eigenvalues of an n \(\times\) n matrix A

The eigenvalues of the characteristic equation of an n\(\times\)n matrix \(A\) are the zeros of

\[\begin{align*} | \lambda I - A | &= 0. \nonumber \end{align*}\]

The eigenvalues are also called the characteristic roots.

Consider, for example, the following matrix \(A\):

\[\begin{align*} A &= \left[ \begin{array} {ccc} 0&1&0 \\ 0&0&1 \\ -6& -11 & -6 \end{array} \right] \end{align*}\]

The characteristic equation is

\[\begin{align*} | \lambda I - A| &= \left | \begin{array} {ccc} \lambda&-1&0 \\ 0&\lambda&-1 \\ 6& 11 & \lambda+6 \end{array} \right| \nonumber \\ &= \lambda^3+6\lambda^2+11\lambda +6\nonumber \\ &= (\lambda+1)(\lambda +2)(\lambda+3) \nonumber \end{align*}\]

The eigenvalues of \(A\) are the roots of the characteristic equation, or -1, -2, and -3.

In Python we use the eig function of the numpy library to calculate the eigenvalues of a matrix:

import numpy as np 
from numpy import linalg as LA

A = np.array([[0,1,0],[0,0,1],[-6,-11,-6]])

w,v= LA.eig(A)
print(w)
[-1. -2. -3.]

Invariance of Eigenvalues

To prove the invariance of the eigenvalues under a linear transformation, we must show that the characteristic polynomials \(|\lambda I - A|\) and \(|\lambda I - P^{-1}AP|\) are identical. Since the determinant of a product is the product of the determinants, we obtain

(6.1)#\[\begin{eqnarray} |\lambda I - P^{-1}AP| &= |\lambda I P^{-1}P - P^{-1}AP| \nonumber \\ &= |P^{-1}(\lambda I -A)P| \nonumber \\ &= |P^{-1}||(\lambda I -A)||P| \nonumber \\ &= |P^{-1}||P||(\lambda I -A)| \nonumber \end{eqnarray}\]

Noting that the product of the determinants \(|P^{-1}|\) and \(|P|\) is the determinant of the product \(|P^{-1}P|=1\), we obtain

\[\begin{align*} |\lambda I - P^{-1}AP| = |\lambda I - A| \nonumber \end{align*}\]

Thus, we have proved that the eigenvalues of \(A\) are invariant under a linear transformation.

Non-uniqueness of a Set of State Variables

It has been stated that a set of state variables is not unique for a given system. Suppose that \(x_1,x_2, \ldots,x_n\) are a set of state variables. Then we may take as another set of state variables any set of functions

\[\begin{align*} \hat x_1&= X_1(x_1,x_2, \ldots, x_n) \nonumber \\ \hat x_2&= X_2(x_1,x_2, \ldots, x_n) \nonumber \\ &\vdots \nonumber \\ \hat x_n&= X_n(x_1,x_2, \ldots, x_n) \nonumber \end{align*}\]

provided that, for every set of values \(\hat x_1, \ldots, \hat x_n\) there corresponds a unique set of values \(x_1, \ldots, x_n\) and vice versa. Thus, if x is a state vector, then \(\mathbf{\hat x}\) , where

(6.2)#\[\begin{equation} \mathbf{ \hat x} = P \mathbf{x} \nonumber \end{equation}\]

is also a state vector, provided the matrix \(P\) is nonsingular. Different state vectors convey the same information about the system behavior.

6.2. Solving the time-invariant State Equation#

In this section,we shall obtain the general solution of the linear time-invariant state equation. We shall first consider the homogeneous case and then the nonhomogeneous case.

Solution of Homogeneous State Equations

Before we solve vector-matrix differential equations, let us review the solution of the scalar differential equation

\[\begin{align*} \dot x &= a x \label{eq:hom2} \tag{3.3} \end{align*}\]

In solving this equation, we may assume a solution x(t) of the form

\begin{align} x(t) &= b_0 + b_1t + b_2t^2+\ldots +b_k t^k+\ldots \label{eq:hom3} \tag{3.4} \end{align}

By substituting this assumed solution into Equation \(\ref{eq:hom2}\), we obtain

\[\begin{align*} b_1+2b_2t+2b_2 t^2+ \ldots + kb_k t^{k-1}+ \ldots = a(b_0 + b_1t + b_2t^2+\ldots +b_k t^k+\ldots) \label{eq:hom1} \tag{3.5} \end{align*}\]

If the assumed solution is to be the true solution, Equation \(\ref{eq:hom1}\) must hold for any t. Hence, equating the coefficients of the equal powers of t , we obtain

\[\begin{align*} b_1 &= a b_0 \nonumber \\ b_2 &= \frac{1}{2} a b_1 = \frac{1}{2} a^2 b_0 \nonumber \\ b_3 &= \frac{1}{3} a b_2 = \frac{1}{3 \times 2} a^3 b_0 \nonumber \\ &\vdots & \nonumber \\ b_k &= \frac{1}{k!} a^k b_0 \nonumber \end{align*}\]

The value of \(b_0\) is determined by substituting \(t = 0\) into Equation \(\ref{eq:hom1}\), or

\[\begin{align*} x(0) &= b_0 \nonumber \end{align*}\]

Hence, the solution x(t) can be written as

\[\begin{align*} x(t) &= \left ( 1+ at+\frac{1}{2!} a^2t^2+ \ldots + \frac{1}{k!} a^k t^k+ \ldots \right )x(0) \nonumber \\ &= e^{at}x(0) \nonumber \end{align*}\]

We shall now solve the vector-matrix differential equation

\[\begin{align*} \mathbf {\dot x} &= A \mathbf{x} \label{eq:hom4} \tag{3.6} \end{align*}\]

where \(\mathbf{x}\)=n-vector and \(A= n \times n\) matrix.

By analogy with the scalar case, we assume that the solution is in the form of a vector power series in t , or

\[\begin{align*} \mathbf{x(t)} &= B_0 + B_1t + B_2t^2+\ldots +B_k t^k+\ldots \label{eq:hom5} \tag{3.7} \end{align*}\]

By substituting this assumed solution into Equation \(\ref{eq:hom4}\), we obtain

\[\begin{align*} B_1+2B_2t+3B_2 t^2+ \ldots + kB_k t^{k-1}+ \ldots &= A(B_0 + B_1t + B_2t^2+\ldots +B_k t^k+\ldots) \label{eq:hom6} \tag{3.8} \end{align*}\]

If the assumed solution is to be the true solution, Equation \(\ref{eq:hom6}\) must hold for all t. Thus, by equating the coefficients of like powers on both sides of Equation \(\ref{eq:hom6}\), we obtain

\[\begin{align*} B_1 &= A B_0 \nonumber \\ B_2 &= \frac{1}{2} A B_1 = \frac{1}{2} A^2 B_0 \nonumber \\ B_3 &= \frac{1}{3} A B_2 = \frac{1}{3 \times 2} A^3 B_0 \nonumber \\ &\vdots & \nonumber \\ B_k &= \frac{1}{k!} A^k B_0 \nonumber \end{align*}\]

The value of \(B_0\) is determined by substituting \(t = 0\) into Equation \(\ref{eq:hom5}\), or

\[\begin{align*} \mathbf{x}(0) = B_0 \nonumber \end{align*}\]

Hence, the solution \(x(t)\) can be written as

\[\begin{align*} \mathbf{x}(t) &= \left ( I+ A t+\frac{1}{2!} A^2t^2+ \ldots + \frac{1}{k!} A^k t^k+ \ldots \right )\mathbf{x}(0) \nonumber \\ &= e^{A t}\mathbf{x}(0) \nonumber \end{align*}\]

Since the matrix exponential is very important in the state-space analysis of linear systems, we shall next examine its properties.

6.2.1. Matrix Exponential#

It can be proved that the matrix exponential of an n\(\times\) n matrix \(A\),

6.2.2. State-Transition Matrix#

We can write the solution of the homogeneous state equation

(6.3)#\[\begin{align} \mathbf{\dot x}(t)& = A \mathbf{x}(t) \label{eq:trans1} \end{align}\]

as

(6.4)#\[\begin{align} \mathbf{x}(t) &= \mathbf{\phi(t)} \mathbf{x}(0) \label{eq:trans2} \end{align}\]

where \(\mathbf{\Phi(t)}\) is an n X n matrix and is the unique solution of

\[\begin{align*} \mathbf{\dot \Phi(t)} = A \mathbf{\Phi(t)} \nonumber \end{align*}\]

6.2.3. Solution of Nonhomogeneous State Equations#

We shall begin by considering the scalar case

(6.5)#\[\begin{equation} \dot x = a x + bu \label{eq:nonhom1} \tag{3.5} \end{equation}\]

Let us rewrite Equation \(\ref{eq:nonhom1}\) as

(6.6)#\[\begin{equation} \dot x -ax = bu \nonumber \end{equation}\]

Multiplying both sides of this equation by \(e^{-at}\), we obtain

(6.7)#\[\begin{equation} e^{-at} \left[ \dot x(t) - a x(t) \right ] = \frac{d}{dt}\left[ e^{-at} x(t) \right ] = e^{-at} b u(t) \nonumber \end{equation}\]

Integrating this equation between 0 and t gives

(6.8)#\[\begin{equation} e^{-at} x(t) - x(0) = \int_0^t e^{-a\tau} b u(\tau) d \tau \nonumber \end{equation}\]

or

(6.9)#\[\begin{equation} x(t) = e^{at} x(0) + e^{at} \int_0^t e^{-a\tau} b u(\tau) d \tau \nonumber \end{equation}\]

The first term on the right-hand side is the response to the initial condition and the second term is the response to the input u(t).

Let us now consider the nonhomogeneous state equation described by

\[\begin{align*} \mathbf{\dot x} &= A \mathbf{x} + B \mathbf{U} \label{eq:nonhom2} \tag{3.10} \end{align*}\]

where \(\mathbf{x}=\)n-vector, \(\mathbf{U}=\) r-vector and \(A=\) n X n constant matrix and \(B=\) n Xr constant matrix.

By writing Equation \(\ref{eq:nonhom2}\) as

\[\begin{align*} \mathbf{\dot x(t)} - A \mathbf{x(t)} &= B \mathbf{U}(t) \label{eq:nonhom5} \tag{3.11} \end{align*}\]

and premultiplying both sides of this equation by \(e^{A t}\), we obtain

\[\begin{align*} e^{-A t} \left[\mathbf{\dot x(t)} - A \mathbf{x(t)} ] \right]&= \frac{d}{dt}\left[ e^{-A t} \mathbf{x}(t) \right ] = e^{-A t} B \mathbf{U}(t) \nonumber \end{align*}\]

Integrating the preceding equation between 0 and t gives

\[\begin{align*} e^{-A t} \mathbf{x}(t) - \mathbf{x}(0) = \int_0^t e^{-A\tau} B \mathbf{U}(\tau) d \tau \nonumber \end{align*}\]

or

\[\begin{align*} \mathbf{x}(t) = e^{A t} \mathbf{x}(0) + \int_0^t e^{-A(t-\tau)} B \mathbf{U}(\tau) d \tau \label{eq:nonhom3} \tag{3.12} \end{align*}\]

Equation \(\ref{eq:nonhom3}\) can also be written as

\[\begin{equation*} \mathbf{x}(t) = \mathbf{\Phi}(t) \mathbf{x}(0) + e^{A t} \int_0^t \mathbf{\Phi}(t-\tau) B \mathbf{U}(\tau) d \tau \label{eq:nonhom4} \tag{3.13} \end{equation*}\]

where \(\mathbf{\Phi}(t)= e^{A t}\). Equation \(\ref{eq:nonhom3}\) or \(\ref{eq:nonhom4}\) is the solution of Equation \(\ref{eq:nonhom5}\).The solution \(\mathbf{x}\)(t) is clearly the sum of a term consisting of the transition of the initial state and a term arising from the input vector.

(6.10)#\[\begin{align} e^{A t} &= \sum_{k=0}^{\infty} \frac{A^k t^k}{k!} \nonumber \end{align}\]

converges absolutely for all finite t. (Hence, computer calculations for evaluating the elements of \(e^{A t}\) by using the series expansion can be easily carried out.) Because of the convergence of the infinite series \(\sum_{k=0}^{\infty} \frac{A^k t^k}{k!}\), the series can be differentiated term by term to give

(6.11)#\[\begin{equation} \frac{d}{dt} e^{A t} = A e^{A t} \nonumber \end{equation}\]

The matrix exponential has the property that

(6.12)#\[\begin{equation} e^{A (t+s)} = e^{A t} e^{A s} \nonumber \end{equation}\]

6.2.4. Laplace Transform Approach to the Solution of Homogeneous State Equations#

Let us first consider the scalar case:

\[\begin{equation*} \dot x = a x \label{eq:hom7} \tag{3.17} \end{equation*}\]

Taking the Laplace transform of Equation \(\ref{eq:hom7}\), we obtain

\[\begin{equation*} s X(s) - x(0) = a X(s) \label{eq:hom8} \tag{3.18} \end{equation*}\]

where \(X ( s ) = \mathcal{L}[x]\). Solving Equation \(\ref{eq:hom7}\) for X(s) gives

(6.13)#\[\begin{equation} X(s)= (s-a)^{-1} x(0) \nonumber \end{equation}\]

The inverse Laplace transform of this last equation gives the solution

(6.14)#\[\begin{equation} x(t)= e^{at} x(0) \nonumber \end{equation}\]

The foregoing approach to the solution of the homogeneous scalar differential equation can be extended to the homogeneous state equation:

\[\begin{equation*} \mathbf{\dot x}(t) = A \mathbf{x}(t) \label{eq:hom9} \tag{3.21} \end{equation*}\]

Taking the Laplace transform of both sides of Equation \(\ref{eq:hom9}\), we obtain

\[\begin{equation*} s \mathbf{X}(s) - \mathbf{x}(0) = A \mathbf{X}(s) \label{eq:hom10} \tag{3.22} \end{equation*}\]

where \(X ( s ) = \mathcal{L}[x]\). Hence,

(6.15)#\[\begin{equation} (sI-A)\mathbf{X}(s)= \mathbf{x}(0) \nonumber \end{equation}\]

Premultiplying both sides of this last equation by \((sI - A)^{-1}\), we obtain

(6.16)#\[\begin{equation} \mathbf{X}(s)= (sI-A)^{-1} \mathbf{x}(0) \nonumber \end{equation}\]

The inverse Laplace transform of this last equation gives the solution \(\mathbf{x}(t)\). Thus,

\[\begin{align*} \mathbf{x}(t)&= \mathcal{L}^{-1} \left [(sI-A)^{-1} \right ] \mathbf{x}(0) \nonumber \end{align*}\]

Note that

(6.17)#\[\begin{equation} (sI-A)^{-1} = \frac{I}{s} + \frac{A}{s^2}+ \frac{A^2}{s^3}+ \ldots \nonumber \end{equation}\]

Hence, the inverse Laplace transform of \((sI - A)^{-1}\),gives

\[\begin{equation*} \mathcal{L}^{-1} \left [(sI-A)^{-1} \right ] = I + A t + \frac{A^2 t^2}{2!} + \frac{A^3 t^3}{3!} + \ldots = e^{A t} \label{eq:hom11} \tag{3.26} \end{equation*}\]

(The inverse Laplace transform of a matrix is the matrix consisting of the inverse Laplace transforms of all elements.) From Equations \(\ref{eq:hom8}\) and \(\ref{eq:hom11}\), the solution of Equation \(\ref{eq:hom9}\) is obtained as

(6.18)#\[\begin{equation} \mathbf{x}(t) = e^{A t} \mathbf{x}(0) \nonumber \end{equation}\]

The importance of Equation \(\ref{eq:hom11}\) lies in the fact that it provides a convenient means for finding the closed solution for the matrix exponential.

6.2.5. Laplace Transform Approach to the Solution of Nonhomogeneous State Equations#

The solution of the nonhomogeneous state equation

\[\begin{equation*} \mathbf{\dot x} = A \mathbf{x} + B \mathbf{U} \label{eq:nh6} \tag{3.20} \end{equation*}\]

can also be obtained by the Laplace transform approach. The Laplace transform of this last equation yields

\[\begin{equation*} s \mathbf{X}(s) - \mathbf{x}(0) = A \mathbf{X}(s) + B \mathbf{U}(s) \nonumber \end{equation*}\]

Premultiplying both sides of this last equation by \((sI - A)^{-1}\), we obtain

\[\begin{equation*} \mathbf{X}(s) =(sI-A)^{-1} \mathbf{x}(0) + (sI-A)^{-1} B \mathbf{U}(s) \nonumber \end{equation*}\]

The inverse Laplace transform of this last equation can be obtained by use of the convolution integral as follows:

\[\begin{equation*} \mathbf{x}(t) = e^{A t} \mathbf{x}(0) + \int_0^t e^{A(t-\tau)}B \mathbf{U}(\tau) d \tau \nonumber \end{equation*}\]

Solution in Terms of \(x(t_0)\)

Thus far we have assumed the initial time to be zero. If, however, the initial time is given by \(t_0\) instead of 0, then the solution to Equation \(\ref{eq:nh6}\) must be modified to

\[\begin{equation*} \mathbf{x}(t) = e^{A (t-t_0)} \mathbf{x}(t_0) + \int_{t_0}^t e^{A(t-\tau)}B \mathbf{U}(\tau) d \tau \nonumber \end{equation*}\]

Example: Obtain the time response of the following system:

\[\begin{align*} \left [ \begin{array}{c} \dot x_1 \\ \dot x_2 \end{array} \right ] = \left [ \begin{array}{cc} 0 & 1 \\ -2 &-3 \end{array} \right] \left [ \begin{array}{c} x_1 \\ x_2 \end{array} \right] + \left[ \begin{array}{c} 0 \\ 1 \end{array} \right] u \end{align*}\]

where u(t)=1(t) is the unit-step function occurring at \(t=0\).

The state-transition matrix \(\mathbf{\phi}(t)=e^{A t}\) is

(6.19)#\[\begin{equation} \phi(t) = \mathcal{L}^{-1} [ (sI -A)^{-1}] \nonumber \end{equation}\]

Since

(6.20)#\[\begin{equation} sI -A = \left[ \begin{array} {cc} s & -1 \\ 2 & s+3 \end{array} \right] \nonumber \end{equation}\]

the inverse of \(( s I - A)\) is given by

(6.21)#\[\begin{eqnarray} (s I - A)^{-1} &=& \frac{adj(s I - A)}{|s I - A)|} = \frac{1}{(s+1)(s+2)} \left[ \begin{array} {cc} s+3 & 1 \\ -2 & s \end{array} \right] \nonumber \\ &=& \left[ \begin{array} {cc} \frac{s+3}{(s+1)(s+2)} & \frac{1}{(s+1)(s+2)} \\ \frac{-2}{(s+1)(s+2)} & \frac{s}{(s+1)(s+2)} \end{array} \right] \nonumber \end{eqnarray}\]

Hence

(6.22)#\[\begin{equation} \phi(t) = e^{A t} = \mathcal{L}^{-1} [ (sI -A)^{-1}] =\left[ \begin{array} {cc} 2e^{-t} - e^{2t} & e^{-t}-e^{-2t} \\ -2e^{-t}+2e^{-2t} & -e^{-t} + 2e^{-2t} \end{array} \right] \end{equation}\]

The response to the unit-step input (1(t)) is then obtained as

\[\begin{equation*} \mathbf{x}(t) = e^{A t} \mathbf{x}(0) + \int_0^t \left[ \begin{array} {cc} 2e^{-(t-\tau)} - e^{2(t-\tau)} & e^{-(t-\tau)}-e^{-2(t-\tau)} \\ -2e^{-(t-\tau)}+2e^{-2(t-\tau)} & -e^{-(t-\tau)} + 2e^{-2(t-\tau)} \end{array} \right] \left[ \begin{array} {c} 0 \\ 1 \end{array} \right] 1(t) d \tau \nonumber \end{equation*}\]

or

(6.23)#\[\begin{equation} \left [\begin{array}{c} x_1(t) \\ x_2(t) \end{array} \right ] = \left[ \begin{array}{cc} 2e^{-t} - e^{2t} & e^{-t}-e^{-2t} \\ -2e^{-t}+2e^{-2t} & -e^{-t} + 2e^{-2t} \end{array} \right ] \left[ \begin{array}{c} x_1(0) \\ x_2(0) \end{array} \right] + \left[ \begin{array}{c} - e^{-t} + \frac{1}{2} e^{-2t} \\ e^{-t} - e^{-2t} \end{array} \right] \end{equation}\]

In software you can simulate this response using the step function

import numpy as np
from control.matlab import ss,step
import matplotlib.pyplot as plt

A = np.array([[0,1],[-2,-3]])
B = np.array([[0],[1]])
C = np.eye(2) #We take both states as output!!!
D = np.array([[0],[0]])

sys=ss(A,B,C,D)

y,t =step(sys)

f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
ax1.plot(t, y[:,0])
ax1.set_xlabel('time [s]')
ax2.plot(t, y[:,1])
ax2.set_xlabel('time [s]')
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[2], line 2
      1 import numpy as np
----> 2 from control.matlab import ss,step
      3 import matplotlib.pyplot as plt
      5 A = np.array([[0,1],[-2,-3]])

ModuleNotFoundError: No module named 'control'

6.3. Controllability#

A system is said to be controllable at time \(t_0\) if it is possible by means of an unconstrained control vector to transfer the system from any initial state \(x(t_0)\) to any other state in a finite interval of time.

A system is said to be observable at time \(t_0\) if, with the system in state \(x(t_0)\), is possible it to determine this state from the observation of the output over a finite time interval. The concepts of controllability and observability were introduced by Kalman. They play an important role in the design of control systems in state space. In fact, the conditions of controllability and observability may govern the existence of a complete solution to the control system design problem. The solution to this problem may not exist if the system considered is not controllable. Although most physical systems are controllable and observable, corresponding mathematical models may not possess the property of controllability and observability. Then it is necessary to know the conditions under which a system is controllable and observable. This section deals with controllability and the next section discusses observability. In what follows, we shall first derive the condition for complete state controllability.

Complete State Controllability of Continuous-Time Systems

Consider the continuous-time system:

(6.24)#\[\begin{equation} \mathbf{\dot x} = A \mathbf{x} + B u \label{eq:obs1} \end{equation}\]

where \(\mathbf{x}\) = state vector (n-vector), u = control signal (scalar), \(A\) = n X n matrix, \(B\) = n X 1 matrix. The system is said to be state controllable at \(t = t_0\) if it is possible to construct an unconstrained control signal that will transfer an initial state to any final state in a finite time interval \(t_0 \leq t \leq t_1\) If every state is controllable, then the system is said to be completely state controllable. It can be proved that the condition for complete state controllability is that the n X n matrix

(6.25)#\[\begin{equation} \left [ B \ \ \vdots \ \ A B \ \ \vdots \ \ ... \ \ \vdots \ \ A^{n-1} B \right] \end{equation}\]

be of rank n, or contain n linearly independent column vectors.

6.3.1. Controllability in software#

We want to know if the following state space model is controllable:

\[\begin{align*} A &= \left[ \begin{array}{ccc} 0,1,0 \\ 0,0,1 \\ -5,-25,-5 \end{array} \right ], B = \left[ \begin{array}{c} 0 \\ 25 \\ -120 \end{array} \right ], C = \left[ \begin{array}{ccc} 1,0,0 \end{array} \right ], D = \left[ \begin{array}{c} 0 \end{array} \right ]. \end{align*}\]
from control.matlab import ctrb 
from numpy import size
from numpy.linalg import matrix_rank

A = [[0,1,0],[0,0,1],[-5,-25,-5]]
B = [[0], [25], [-120] ]
C = [1,0,0]
D = [0]
co=ctrb(A,B)
Controllability=0
if matrix_rank(co)==size(A,axis=1):  
  Controllability=1 
print('Controllability=',
Controllability )
Controllability= 1

6.4. Observability#

In this section we discuss the observability of linear systems. Consider the unforced system described by the following equations:

\[\begin{align*} \mathbf{\dot x} &= A \mathbf{x} \label{ob3} \tag{3.26}\\ \mathbf{y} &= C \mathbf{x} \label{ob4} \tag{3.27} \end{align*}\]

The system is said to be completely observable if every state \(\mathbf{x}(t_0)\) can be determined from the observation of \(\mathbf{y}(t)\) over a finite time interval, \(t_0 \leq t \leq t_1\) .The system is, therefore, completely observable if every transition of the state eventually affects every element of the output vector.The concept of observability is useful in solving the problem of reconstructing unmeasurable state variables from measurable variables in the minimum possible length of time. In this section we treat only linear, time-invariant systems. Therefore, without loss of generality, we can assume that \(t_0 = 0\). The concept of observability is very important because, in practice, the difficulty encountered with state feedback control is that some of the state variables are not accessible for direct measurement, with the result that it becomes necessary to estimate the unmeasurable state variables in order to construct the control signals.

The system described by Equations \(\ref{ob3}\)and \(\ref{ob4}\) is completely observable if and only if the n X nxm matrix

(6.26)#\[\begin{equation} \left [ C \ \ \vdots \ \ C A \ \ \vdots \ \ ... \ \ \vdots \ \ C A^{n-1} \right] \end{equation}\]

is of rank n or has n linearly independent column vectors. This matrix is called the observability matrix.

6.4.1. Observability in software#

We want to know if the following state space model is observable:

\[\begin{align*} A &= \left[ \begin{array}{ccc} 0,1,0 \\ 0,0,1 \\ -5,-25,-5 \end{array} \right ], B = \left[ \begin{array}{c} 0 \\ 25 \\ -120 \end{array} \right ], C = \left[ \begin{array}{ccc} 1,0,0 \end{array} \right ], D = \left[ \begin{array}{c} 0 \end{array} \right ]. \end{align*}\]
from control.matlab import  obsv
from numpy import size
from numpy.linalg import matrix_rank

A = [[0,1,0],[0,0,1],[-5,-25,-5]]
B = [[0], [25], [-120] ]
C = [1,0,0]
D = [0]
ob=obsv(A,C)
Observability=0
if matrix_rank(ob)==size(A,axis=1):  
  Observability=1 
print('Observability=',Observability )
Observability= 1

6.5. Pole Placement#

In this section we shall present a design method commonly called the pole placement or pole-assignment technique. We assume that all state variables are measurable and are available for feedback. It will be shown that if the system considered is completely state controllable, then poles of the closed-loop system may be placed at any desired locations by means of state feedback through an appropriate state feedback gain matrix.

The present design technique begins with a determination of the desired closed-loop poles based on the transient-response and/or frequency-response requirements, such as speed, damping ratio, or bandwidth, as well as steady-state requirements.

Let us assume that we decide that the desired closed-loop poles are to be at \(s = \mu_1 , s = \mu_2,.. . , s = \mu_n\). By choosing an appropriate gain matrix for state feedback, it is possible to force the system to have closed-loop poles at the desired locations, provided that the original system is completely state controllable.

In this chapter we limit our discussions to single-input-single-output systems. That is, we assume the control signal u (t) and output signal y(t) to be scalars.

In what follows we shall prove that a necessary and sufficient condition that the closed-loop poles can be placed at any arbitrary locations in the s plane is that the system be completely state controllable. Then we shall discuss methods for determining the required state feedback gain matrix.

It is noted that when the control signal is a vector quantity, the mathematical aspects of the pole-placement scheme become complicated. We shall not discuss such a case in this book. (When the control signal is a vector quantity, the state feedback gain matrix is not unique. It is possible to choose freely more than n parameters; that is, in addition to being able to place n closed-loop poles properly, we have the freedom to satisfy some or all of the other requirements, if any, of the closed-loop system.)

6.5.1. Design by Pole Placement#

In the conventional approach to the design of a single-input-single-output control system, we design a controller (compensator) such that the dominant closed-loop poles have a desired damping ratio \(\zeta\) and an undamped natural frequency \(\omega_n\). In this approach, the order of the system may be raised by 1 or 2 unless pole-zero cancellation takes place. Note that in this approach we assume the effects on the responses of non-dominant closed-loop poles to be negligible.

Different from specifying only dominant closed-loop poles (the conventional design approach), the present pole-placement approach specifies all closed-loop poles. (There is a cost associated with placing all closed-loop poles, however, because placing all closed-loop poles requires successful measurements of all state variables or else requires the inclusion of a state observer in the system.) There is also a requirement on the part of the system for the closed-loop poles to be placed at arbitrarily chosen locations. The requirement is that the system be completely state controllable.

Consider a control system

\[\begin{align*} \mathbf{\dot x} &= A \mathbf{x} + B u \label{eq:pole1} \tag{3.27} \\ y &= C \mathbf{x} + D u \nonumber \end{align*}\]

where \(\mathbf{x}=\) state vector (n-vector), y= output signal (scalar), u = control signal (scalar), \(A=\) n X n constant matrix, \(B=\)n X 1 constant matrix, \(C=\) 1 X n constant matrix and D = constant (scalar).

We shall choose the control signal to be

(6.27)#\[\begin{align} u &= - K \mathbf{x} \label{eq:pole2} \tag{3.28} \end{align}\]

6.5.2. Determination of Matrix \(K\) Using Direct Substitution Method#

If the system is of low order (\(n \leq 3\)), direct substitution of matrix \(K\) into the desired characteristic polynomial may be simpler. For example, if \(n = 3\), then write the state feedback gain matrix \(K\) as

\[\begin{align*} K = \left[ k_1 \ \ k_2 \ \ k_3 \right] \nonumber \end{align*}\]

Substitute this \(K\) matrix into the desired characteristic polynomial \(|sI - A + B K|\) and equate it to \(( s - \mu_1,)(s - \mu_2)(s - \mu_3 )\) ,or

\[\begin{align*} | sI-A+B K| &= (s - \mu_1,)(s - \mu_2)(s - \mu_3 ) \end{align*}\]

Since both sides of this characteristic equation are polynomials in s, by equating the coefficients of the like powers of s on both sides, it is possible to determine the values of \(k_1, k_2,k_3\). This approach is convenient if n = 2 or 3. (For n = 4, 5 , 6, … , this approach may become very tedious.)

Note that if the system is not completely controllable, matrix \(K\) cannot be determined. (No solution exists.)

6.5.3. Choosing the Locations of Desired Closed-Loop Poles#

The first step in the pole-placement design approach is to choose the locations of the desired closed-loop poles. The most frequently used approach is to choose such poles based on experience in the root-locus design, placing a dominant pair of closed-loop poles and choosing other poles so that they are far to the left of the dominant closed-loop poles.

Note that if we place the dominant closed-loop poles far from the \(j\omega\) axis, so that the system response becomes very fast, the signals in the system become very large, with the result that the system may become nonlinear. This should be avoided.

Another approach is based on the quadratic optimal control approach. This approach will determine the desired closed-loop poles such that it balances between the acceptable response and the amount of control energy required. Note that requiring a high-speed response implies requiring large amounts of control energy. Also, in general, increasing the speed of response requires a larger, heavier actuator, which will cost more.

Example: Consider the regulator system given by

\[\begin{align*} \mathbf{\dot x} &= A \mathbf{x} + B u \label{eq:ex_pole1} \tag{3.29} \end{align*}\]

where

\[\begin{equation*} A=\left[ \begin{array}{ccc} 0&1&0 \\ 0&0&1 \\ -1& -5 & -6 \end{array} \right] , \ \ \ B = \left [ \begin{array}{c} 0\\0\\1 \end{array} \right ] \nonumber \end{equation*}\]

The system uses the state feedback control \(u = -K\mathbf{x}\). Let us choose the desired closed-loop poles at

\[\begin{equation*} s=-2+j4, \ \ s=-2-j4, \ \ s=-10 \nonumber \end{equation*}\]

Determine the state feedback gain matrix \(K\).

First, we need to check the controllability matrix of the system. Since the controllability matrix \(M\) is given by

\[\begin{equation*} M = \left[ B \ \ \vdots \ \ A B \ \ \vdots \ \ A^2B \right] = \left[ \begin{array}{ccc} 0 & 0 & 1 \\ 0 & 1 & -6 \\ 1 & -6 & 31 \end{array} \right] \end{equation*}\]

we find that \(|M| = -1\), and therefore, rank \(M = 3\). Thus, the system is completely state controllable and arbitrary pole placement is possible.

By defining the desired state feedback gain matrix \(K\) as

\[\begin{equation*} K = [ k_1 \ \ k_2 \ \ k_3] \nonumber \end{equation*}\]

and equating \(|sI - A+ BK|\) with the desired characteristic equation, we obtain

(6.28)#\[\begin{eqnarray} |sI - A+ BK| &=& \left | \begin{array}{ccc} s & -1 & 0 \\ 0& s & -1 \\ 1+k_1 & 5+k_2 & s+6+k_3 \end{array} \right| \nonumber\\ &=& s(s(6+s+k_3)+(5+k_2))+1+k_1 \nonumber \\ &=& s^3 + (6+k_3)s^2+(5+k_2)s + 1+k_1 \nonumber\\ &=& (s+2-j4)(s+2+j4)(s+10) = s^3+14s^2+60s+200 \nonumber \end{eqnarray}\]

from which we obtain

(6.29)#\[\begin{equation} 1+k_1 = 200, \ \ 5+k_2=60, \ \ 6+k_3=14 \nonumber \end{equation}\]

or

\[\begin{equation*} k_1 = 199, \ \ k_2=55, \ \ k_3=8 \nonumber \end{equation*}\]

6.6. Pole Placement with software#

Pole-placement problems can be solved easily with software. The software has two commands (acker and place) for the computation of feedback-gain matrix \(K\). The command acker is based on Ackermann’s formula. This command applies to single-input systems only. The desired closed-loop poles can include multiple poles (poles located at the same place).

If the system involves multiple inputs, for a specified set of closed-loop poles the state-feedback gain matrix \(K\) is not unique and we have an additional freedom (or freedoms) to choose \(K\). There are many approaches to constructively utilize this additional freedom (or freedoms) to determine \(K\). One common use is to maximize the stability margin. The pole placement based on this approach is called the robust pole placement. The software command for the robust pole placement is place. Although the command place can be used for both single-input and multiple-input systems, this command requires that the multiplicity of poles in the desired closed-loop poles be no greater than the rank of B. That is, if matrix B is an n X 1 matrix, the command place requires that there be no multiple poles in the set of desired closed-loop poles.

For single-input systems, the commands acker and place yield the same \(K\). (But for multiple-input systems, one must use the command place instead of acker.)

It is noted that when the single-input system is barely controllable, some computational problem may occur if the command acker is used. In such a case the use of the place command is preferred, provided that no multiple poles are involved in the desired set of closed-loop poles.

To use the command acker or place, we first enter values for the matrices: \(A,B,J\). Where \(J\) matrix is the matrix consisting of the desired closed-loop poles such that

(6.30)#\[\begin{equation} J = [ \mu_1 \ \ \mu_2 \ \ \ldots \ \ \mu_2 ] \nonumber \end{equation}\]

Then we can use the Python acker function

K = acker(A,B,J)

or the Python place function

K = place(A,B,J)

It is noted that the command \(eig(A-B*K)\) may be used to verify that \(K\) obtained gives the desired eigenvalues.

Example 1: Consider the regulator system given by equation \(\ref{eq:ex_pole1}\)

where

(6.31)#\[\begin{equation} A=\left[ \begin{array}{ccc} 0&1&0 \\ 0&0&1 \\ -1& -5 & -6 \end{array} \right] , \ \ \ B = \left [ \begin{array}{c} 0\\0\\1 \end{array} \right ]. \nonumber \end{equation}\]

Design a state feedback controller.

from control.matlab import acker,place,step,feedback
import numpy as np 


#Define the system: 
A = [[0,1,0],[0,0,1],[-1,-5,-6] ];
B = [[0],[0],[1]];
C = np.eye(3);
D = [[0],[0],[0]]

sys=ss(A,B,C,D)

#Define the closed loop poles:
J = [-2+4j,-2-4j,-10];

#Check if the system is controllable:

co=ctrb(A,B)
Controllability=0
if matrix_rank(co)==size(A,axis=1):  
  Controllability=1 
print('Controllability=',
Controllability )

#Determine the state feedback conytroller K: 

K = acker(A,B,J)
print("Acker result K=",K)
K = place(A,B,J)
print("Place result K=",K)

#Simulate the response:

y, t =step(feedback(sys,K))

f, (ax1, ax2,ax3) = plt.subplots(1, 3,figsize=(20,4))
ax1.plot(t, y[:,0])
ax1.set_xlabel('time [s]')
ax1.set_ylabel('State 1 ')
ax2.plot(t, y[:,1])
ax2.set_xlabel('time [s]')
ax2.set_ylabel('State 2 ')
ax3.plot(t, y[:,2])
ax3.set_xlabel('time [s]')
ax3.set_ylabel('State 3')
Controllability= 1
Acker result K= [[199.  55.   8.]]
Place result K= [[199.  55.   8.]]
Text(0, 0.5, 'State 3')
../../_images/e46f9f991b59dfa471a48f900de81ca7f57a24ae353b71f63cedbe68ac8d90d1.png

6.7. State space servo system design#

TODO

6.8. State space observer design#

TODO

6.9. Design of a servo system with observer#

TODO