= [0 1; -1 -3]
A = [0; 1]
B = [-3+2im -3-2im]
p = place(A,B,p) K
1×2 Matrix{ComplexF64}:
12.0+0.0im 3.0+0.0im
November 19, 2024
Consider a SSM \[\begin{align*} \dot x(t) &= A x(t) + B u(t) \\ y(t) &= C x(t) \end{align*}\]
In this section, we will learn how to control such a system when the controller has access to the internal state \(x(t)\). This is called state feedback. In the next section, we will learn how to design a system when the controller has access to only the output \(y(t)\). This is called output feedback.
The basic idea of state feedback is shown in Figure 1. The system has two tunable blocks: the feedback gain \(K\) which is a \(1 \times n\) matrix and the pre-compensator \(N\), which is a scalar. The equation for the input-output system may be written as: \[\begin{align*} \dot x(t) &= A x(t) + B \bigl( N r(t) - K x(t) \bigr), \\ y(t) &= C x(t), \end{align*}\] or, equivalently, \[\begin{align*} \dot x(t) &= (A - BK) x(t) + B N r(t), \\ y(t) &= C x(t), \end{align*}\] where \(N \in \reals\) and \[ K = \MATRIX{k_0 & \cdots & k_{n-1}}. \]
We will first consider the system without any input (i.e., \(r(t) = 0\)) and consider the zero input response. In this case, we only need to design \(K\), which has \(n\) tunable gains \(k_0, \dots, k_{n-1}\). The hope is that we can find these gain to arbitrarily choose the eigenvalues of the closed loop system. This is called pole placement.
We will start by looking at system in CCF and show that for such systems pole placement can be achieved by simply comparing coefficients of the characteristic polynomial of the open loop systems and the designed characteristic polynomial of the closed loop system. We will then look at systems that are not in CCF and show that if the system satisfies a condition known as controllability, we can find a transformation that converts the to CCF and use the results from state transformation to find \(K\).
Consider a state space system in CCF with \[ A = \MATRIX{ 0 & 1 & 0 & \cdots & 0 \\ 0 & 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & \cdots & 1 \\ -a_0 & -a_1 & \cdots & \cdots & - a_{n-1} }, \quad B = \MATRIX{0 \\ 0 \\ \vdots \\ 0 \\ 1}. \]
We want to desgin a state feedback controller \[ u(t) = -K x(t) \quad \text{where } K = \MATRIX{k_0 & \cdots & k_{n-1}} \] such that the characteristic polynomial of the closed loop system is \[ \det(sI - (A - BK)) = s^n + α_{n-1} s^{n-1} + \cdots + α_1 s + α_0. \]
Observe that \[ B K = \MATRIX{0 \\ \vdots \\ 0 \\ 1} \MATRIX{k_0 & \cdots & k_{n-1}} = \MATRIX{ 0 & 0 & \cdots & 0 \\ \vdots & \vdots & \vdots & \vdots \\ 0 & 0 & \cdots & 0 \\ k_0 & k_1 & \cdots & k_{n-1} }. \] Thus, \[ A - BK = \MATRIX{ 0 & 1 & 0 & \cdots & 0 \\ 0 & 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & \cdots & 1 \\ -(a_0+k_0) & -(a_1+k_1) & \cdots & \cdots & -(a_{n-1} + k_{n-1}) }, \] which has the CCF structure. Thus, \[ \det(sI - (A - BK)) = s^n + (a_{n-1} + k_{n-1}) s^{n-1} + \cdots + (a_1 + k_1) s + (a_0 + k_0). \]
Observe that each component of the gain matrix \(K\) affects only one coefficient of the characteristic polynomial. Thus, we can pick \[ \bbox[5pt,border: 1px solid] {K = \MATRIX{ α_0 - a_0 & \cdots & α_{n-1} - a_{n-1}}} \] to place the poles of the closed loop system at any desired location.
Example 1 Consider the system \[ A = \MATRIX{0 & 1 \\ -1 & -3}, \quad B = \MATRIX{0 \\ 1}. \] Determine a state feedback controller such that the eigenvalues of the closed loop system are at \(-3 \pm 2j\).
The desired characteristic polynomial is \[(s + 3)^2 + 2^2 = s^2 + 6s + 13.\]
The current characteristic polynomial is (since the system is in CCF, we can determine it by inspection) \[\det(sI - A) = s^2 + 3s + 1.\]
Thus, the required state feedback matrix is \[K = \MATRIX{13 - 1 & 6 - 3} = \MATRIX{12 & 3}.\]
We verify the solution below:
When a system is not in CCF, we can still use the design idea for systems in CCF if there exists a transformation (or change of coordinates) \(x_c(t) = T^{-1} x(t)\) such that the system matrices for the system \((A_c, B_c, C_c)\) for \(x_c(t)\) are in CCF. If such a transformation can be found, then we can find the gain matrix \(K_c\) for the system in CCF using the method of the previous section and use1 \[ K = K_c T^{-1} \] as the gain for the original system. So, the main question is: how do we find such a transformation?
1 The state feedback in the new coordinate system is \[u(t) = - K_c x_c(t).\] Since \(x_c(t) = T^{-1} x(t)\), we have \[ u(t) = - K_c T^{-1} x(t). \] Therefore \(K = K_c T^{-1}\).
The controllability matrix of a state space system \((A,B)\) is defined as \[\mathcal C_{(A,B)} = \MATRIX{B & AB & \cdots & A^{n-1} B }.\]
Now consider a change of coordinates \(x_c(t) = T^{-1} x(t)\). Recall that the state space representation in the new coordinate system is \[ A_c = T^{-1} A T \quad B_c = T^{-1} B. \] Observe that
Therefore,
Therefore, the controllability matrix of the system in the new coordinates is \[\begin{align*} \mathcal C_{(A_c, B_c)} &= \MATRIX{ T^{-1} B & T^{-1} A B & \cdots & T^{-1} A^{n-1} B } \\ &= T^{-1} \MATRIX{B & AB & \cdots A^{n-1} B } \\ &= T^{-1} \mathcal C_{(A,B)}. \end{align*}\]
Thus, we can go from the SSM \((A,B)\) to the SSM \((A_c, B_c)\) using the transformation \[ T^{-1} = \mathcal C_{(A_c, B_c)} \mathcal C_{(A,B)}^{-1} \] provided \(\mathcal C_{(A,B)}\) is invertible (i.e., has full rank). When that is the case, we say that the system is controllable.
There are different ways in which we can get uncontrollable models as is illustrated in the following example.
Example 2 Check if the following systems are controllable.
\(A = \MATRIX{2 & 0 \\ 0 & 3}\) and \(B = \MATRIX{0 \\ 1}\).
\(A = \MATRIX{-4 & 5 \\ 0 & 9}\) and \(B = \MATRIX{-2 \\ 0}\).
\(A = \MATRIX{1 & 5 \\ 8 & 4}\) and \(B = \MATRIX{-2 \\ 2}\).
We have \[ A B = \MATRIX{2 & 0 \\ 0 & 3} \MATRIX{ 0 \\ 1} = \MATRIX{0 \\ 3}.\] Thus, \[ \mathcal C_{(A,B)} = \MATRIX{ 0 & 0 \\ 1 & 3}. \] We have \(\det \mathcal C_{(A,B)} = 0\). So, \((A,B)\) is not controllable.
We have \[ A B = \MATRIX{-4 & 5 \\ 0 & 9 } \MATRIX{ -2 \\ 0} = \MATRIX{8 \\ 0}.\] Thus, \[ \mathcal C_{(A,B)} = \MATRIX{ -2 & -8 \\ 0 & 0}. \] We have \(\det \mathcal C_{(A,B)} = 0\). So, \((A,B)\) is not controllable.
We have \[ A B = \MATRIX{ 1 & 5 \\ 8 & 4} \MATRIX{ -2 \\ 2} = \MATRIX{8 \\ -8}.\] Thus, \[ \mathcal C_{(A,B)} = \MATRIX{ -2 & 8 \\ 2 & -8}. \] We have \(\det \mathcal C_{(A,B)} = 0\). So, \((A,B)\) is not controllable.
We can use the above idea to design state feedback controller for systems not in CCF. In particular, the pole placement problem is as follows.
We are given a SSM \((A,B)\) not in CCF and we want to find a state feedback controller \[ u(t) = - K x(t), \quad \text{where } K = \MATRIX{k_0 & \cdots & k_{n-1} } \] such that the characteristic polynomial of the closed loop system is \[ \det(sI - A + BK) = s^n + α_{n-1} s^{n-1} + \cdots + α_1 s + α_0. \]
We present two methods for pole placement.
Find the controllability matrix \(\mathcal C_{(A,B)}\) of the system.
If the system is not controllable, i.e., the controllability matrix is not full rank (which can be tested by checking that the determinant of the controllability matrix is non-zero), pole placement is not possible and we quit the procedure.
If the system is controllable, find the characteristic polynomial of \(A\): \[\det(s I - A) = s^n + a_{n-1} s^{n-1} + \cdots + a_0 \]
Using the above characteristic polynomial, write the SSM \((A_c, B_c)\) in CCF.
Recall that the characteristic polynomial is the denominator of the transfer function
Compute the controllability matrix \(\mathcal C(A_c, B_c)\) of the system \((A_c, B_c)\) in CCF.
Compute the transformation \[\bbox[5pt,border: 1px solid]{ T^{-1} = \mathcal C_{(A_c, B_c)} \mathcal C_{(A,B)}^{-1} }\]
Compute the controller gain \(K_c\) for the system in CCF: \[ K_c = \MATRIX{ α_0 - a_0 & \cdots & α_{n-1} - a_{n-1}}. \]
The controller gain for the original system is \[K = K_c T^{-1}.\]
It is possible to avoid the computation of the controllability matrix of the system in CCF by replacing steps 4–6 of Method 1 by the following:
Compute the matrix \[ W = \MATRIX{ a_1 & a_2 & \cdots & a_{n-1} & 1 \\ a_2 & \iddots & \iddots & 1 & 0 \\ \iddots & \iddots & \iddots & \iddots & \vdots \\ a_{n-1} & 1 & 0 & \cdots & 0 \\ 1 & 0 & 0 & \cdots & 0 } \]
Compute the transformation: \[\bbox[5pt,border: 1px solid]{ T^{-1} = \bigl[ \mathcal C_{(A,B)} W \bigr]^{-1} }\]
This method relies on the fact that for a system \((A_c,B_c)\) in CCF, \(\mathcal C_{(A_c,B_c)} = W^{-1}\). For a proof, see Lemma 3.5 of William and Lawrence.
Example 3 Consider the following SSM: \[ A = \MATRIX{3 & 1 \\ 1 & 2}, B = \MATRIX{2 \\1} \text{ and } C = \MATRIX{ 3 & 2}. \] Design a state feedback controller (i.e., compute the feedback gain \(K\)) such that the eigenvalues of the closed loop system are at \(-2 \pm 2j\).
We will show the solution via both method 1 and method 2. For method 1, we have the following.
We have \[ A B = \MATRIX{3 & 1\\ 1 & 2} \MATRIX{2 \\ 1} = \MATRIX{7 \\ 4}. \] Therefore, \[ \mathcal C_{(A,B)} = \MATRIX{ 2 & 7 \\ 1 & 4}. \]
\(\det \mathcal C_{(A,B)} = 8 - 7 = 1 \neq 0\). Thus, \((A,B)\) is controllable and we can design a state feedback controller.
The characteristic polynomial is given by \[s I - A = \MATRIX{s & 0 \\ 0 & s} - \MATRIX{3 & 1 \\ 1 & 2} = \MATRIX{ s-3 & -1 \\ -1 & s - 2}.\] Therefore, \[ \det(sI-A) = \DET{ s-3 & -1 \\ -1 & s - 2} = (s-3)(s-1) - 1 = s^2 - 5s + 5. \]
The SSM in CCF is \[ A_c = \MATRIX{0 & 1 \\ -5 & 5}, \quad B_c = \MATRIX{0 \\ 1}.\]
We have \[ A_c B_c = \MATRIX{ 0 & 1 \\ -5 & 5} \MATRIX{0 \\ 1} = \MATRIX{1 \\ 5}. \] Therefore, \[ \mathcal C_{(A_c, B_c)} = \MATRIX{0 & 1 \\ 1 & 5}. \]
Thus, we have \[\begin{align*} T^{-1} &= \mathcal C_{(A_c,B_c)} \mathcal C_{(A,B)}^{-1} \\ &= \MATRIX{0 & 1 \\ 1 & 5} \MATRIX{2 & 7 \\ 1 & 4}^{-1} \\ &= \MATRIX{0 & 1 \\ 1 & 5} \MATRIX{4 & -7 \\ -1 & 2} \\ &= \MATRIX{-1 & 2 \\ -1 & 3}. \end{align*}\]
The desired characteristic polynomial is \[ (s+2-2j)(s+2+2j) = (s+2)^2 + 2^2 = s^2 + 4s + 8. \] Thus, \[ K_c = \MATRIX{8 - 5 & 4 - (-5)} = \MATRIX{3 & 9}.\]
Thus, \[ K = K_c T^{-1} = \MATRIX{3 & 9} \MATRIX{-1 & 2 \\ -1 & 3} = \MATRIX{-12 & 33}. \]
We can verify that the gain is correct.
1×2 Matrix{ComplexF64}:
-12.0+0.0im 33.0+0.0im
Finally, we can redo the calculations using Method 2. In particular, instead of steps 4–6, we have
Define \[ W = \MATRIX{ a_1 & 1 \\ 1 & 0 } = \MATRIX{ -5 & 1 \\ 1 & 0 }. \]
Therefore, \[\begin{align*} T^{-1} &= \bigl[ \mathcal C_{(A,B)} W \bigr]^{-1} \\ &= \left( \MATRIX{2 & 7 \\ 1 & 4} \MATRIX{-5 & 1 \\ 1 & 0 } \right)^{-1} \\ &= \MATRIX{-1 & 2 \\ -1 & 3}, \end{align*}\]
Thus, we get the same \(T\) as using Method 1. The remaining steps 7 and 8 are the same as before.
We now return to the architecture shown in Figure 1 and consider the design of the pre-compensator \(N\). The idea is to choose the pre-compensator \(N\) to ensure that steady state error is zero. In particular, we know that the DC-gain of the system is \[ \text{DC-gain} = N G(0) = N C (sI - (A - BK) )^{-1} B \bigg|_{s = 0} = - N C (A-BK)^{-1} B. \] To ensure that steady-state error when tracking a step input is zero, we pick the pre-compensator gain \(N\) as follows: \[ N = - \frac{1}{ C(A-BK)^{-1} B }. \]
In this section, we provide some intuition to understand why controllability plays a critical role in state feedback. Consider the SSM
\[\begin{align*} \dot x(t) &= A x(t) + B u(t) \\ y(t) &= C x(t). \end{align*}\]
As we saw in the last section, the zero-state response of the system is \[ x(t) = \int_{0}^t e^{A τ} B u(t-τ)\, d τ. \]
We already say that \[ e^{At} = I + At + \frac{A^2 t^2}{2!} + \frac{A^3 t^3}{3!} + \cdots \] From :Caley-Hamilton Theorem, we know that any \(A^k\) for \(k \ge n\) can be expressed in terms of \(A^0, \dots, A^{n-1}\). Thus, we can write \[ e^{At} = \sum_{k=0}^{n-1} w_k(t) A^k \] for some weight functions \(\{w_k(t)\}_{k=0}^n\).
Hence, we can write the state \(x(t)\) as \[\begin{align*} x(t) &= \int_{0}^t \left( \sum_{k=0}^{n-1} w_k(t) A^k \right) B u(t - τ)\, d τ \\ &= \sum_{k=0}^{n-1} A^k B \underbrace{\left[\int_{0}^t w_k(t) u(t - τ)\, d τ\right]} _{\eqqcolon v_k(t)} \\ &= \sum_{k=0}^{n-1} A^{k-1} B v_k(t) \end{align*}\] where \(v_k(t)\) denote on the control input \(u(t)\).
Let \(M_c\) denote the range space of \(\mathcal C_{(A,B)}\). Then, by definition, for any input \(u(t)\), \[ x(t) = \sum_{k=0}^{n-1} A^{k-1} B v_k(t) = \mathcal C_{(A,B)} v(t) \in M_c. \]
So, no matter what control inputs we use, we can only reach states belonging to \(M_c\). If \[\text{rank}(\mathcal C_{(A,B)}) = \text{rank}(M_c) \neq n,\] then there is a subspace that cannot be reached by any control input! This is actually the formal definition of controllability.
A SSM is said to be controllable if for every initial condition \(x_0\), time \(t\), and state \(x\) at time \(t\), there exists a control input \(u\) that moves the system starting at initial state \(x_0\) to state \(x\) at time \(t\).
The argument presented above shows that a system is controllable if and only if \(\text{rank}(\mathcal C_{(A,B)} = n\).
Example 4 Consider \[ A = \MATRIX{-2 & 0 \\ 0 & -1} \quad\text{and}\quad B = \MATRIX{2 \\ 0}. \]
Then, \[\mathcal C_{(A,B)} = \MATRIX{2 & -4 \\ 0 & 0 }.\] Therefore, \[ \text{range}(\mathcal C_{(A,B)}) = \left\{ \MATRIX{ α \\ 0 } : α \in \reals \right\}. \] Thus, no matter what input we choose, we cannot reach vectors belonging to the subspace \[ \left\{ \MATRIX{ 0 \\ β } : β \in \reals \right\}. \]
The above example shows that for systems where \(A\) matrix is diagonal, it is easy to interpret controllability: a system \((A,B)\) where \(A\) is diagonal is uncontrollable if some element of \(B\) is zero, which means that there is a mode (i.e., eigen-direction) such that the input cannot effect the evolution of the state in that eigen-direction.
Let’s revisit the examples in Example 2. Let \((λ_1, v_1)\) and \((λ_2, v_2)\) be the eigenvalue-eigenvector pairs for each model. Take \(T = [v_1, v_2]\) and consider the change of variables \(\tilde x = T^{-1} x\). In this new coordinate system \[ \tilde A = T^{-1} A T, \quad \tilde B = T^{-1} B. \] We have that
We take \(T = \MATRIX{1 & 0 \\ 0 & 1}\). Thus, we have \[\tilde A = \MATRIX{2 & 0 \\ 0 & 3}, \quad \tilde B = \MATRIX{0 \\ 1}.\]
We take \(T = \MATRIX{1 & 5 \\ 0 & 13}\). Thus, we have \[\tilde A = \MATRIX{-4 & 0 \\ 0 & 3}, \quad \tilde B = \MATRIX{-2 \\ 0}.\]
We take \(T = \MATRIX{-1 & 5 \\ 1 & 8}\). Thus, we have \[\tilde A = \MATRIX{-4 & 0 \\ 0 & 3}, \quad \tilde B = \MATRIX{2 \\ 0}.\]
Thus, in all cases, there is an eigen-direction that cannot be controlled!
Finally, we consider the following circuit to see why a physical system may be uncontrollable.
We will follow the approach presented in previous section to find a SSM for the circuit in Figure 2. We take the voltage across the two capcitors (denoted by \(v_1\) and \(v_2\)) as the two components of the SSM. From KCL, we have \[\begin{align*} C_1 \dot v_1(t) &= \frac{u(t) - v_1(t)}{R_1} - \frac{v_1(t) - v_2(t)}{R_3} \\ C_2 \dot v_2(t) &= \frac{u(t) - v_2(t)}{R_2} + \frac{v_1(t) - v_2(t)}{R_3} \end{align*}\] which can be re-written in state-space form as: \[\def\1{\vphantom{\dfrac{1}{R_1C_1}}} \MATRIX{ \1\dot v_1(t) \\ \1\dot v_2(t) } = \MATRIX{ -\left(\dfrac{1}{R_1C_1} + \dfrac{1}{R_3C_1}\right) & \dfrac{1}{R_3C_1} \\ \dfrac{1}{R_3C_2} & -\left(\dfrac{1}{R_2C_2} + \dfrac{1}{R_3C_2}\right)} \MATRIX{ \1v_1(t) \\ \1v_2(t) } + \MATRIX{\dfrac{1}{R_1C_1} \\ \dfrac{1}{R_2C_2}} u(t). \] Consider the difference \(\tilde v(t) = v_1(t) - v_2(t) = \MATRIX{I & -I} \MATRIX{v_1(t) \\ v_2(t)}\), which satisfies \[ \dot {\tilde v(t)} = -\left[\frac{1}{R_1C_1} + \frac{2}{R_3C_1} \right] v_1(t) +\left[\frac{1}{R_2C_2} + \frac{2}{R_3C_2} \right] v_2(t) + \left[ \frac{1}{R_1C_1} - \frac {1}{R_2C_2} \right] u(t). \] When the bridge is balanced, i.e., \(R_1 = R_2 = R\) and \(C_1 = C_2 = C\), we have \[ \dot {\tilde v(t)} = -\left[ \frac{1}{RC} + \frac{2}{R_3 C} \right] \tilde v(t) \] which is a homogeneous equation with no input. Thus, in this case, the control input \(u(t)\) has no impact on the subspace \(v_1(t) - v_2(t)\) of the state space. Thus, the system is not controllable.
We can also verify this via the controllability matrix, whic is given by \[ \mathcal C = \MATRIX{ \dfrac{1}{RC} & -\dfrac{1}{(RC)^2} \\ \dfrac{1}{RC} & -\dfrac{1}{(RC)^2}} \] which is not full rank.
Uncontrollability is often related to pole zero cancelling. Consider the following transfer function: \[ G(s) = \frac{s - z}{s^2 + 3s + 2}. \] Let’s compare the CCF and OCF representations of the system:
CCF representation \[ A_c = \MATRIX{0 & 1 \\ -2 & -3 }, \quad B_c = \MATRIX{0 \\ 1}, \quad C_c = \MATRIX{-z & 1}. \]
OCF representation \[ A_o = \MATRIX{0 & -2 \\ 1 & -3 }, \quad B_o = \MATRIX{-z \\ 1}, \quad C_o = \MATRIX{0 & 1}. \]
Observe that in the CCF representation the matrices \((A_c, B_c)\) do not depend on the location \(z\) of the zero. Therefore, neither does the controllability matrix, which is given by \[ \mathcal C_{(A_c, B_c)} = \MATRIX{ 0 & 1 \\ 1 & -3 } \] On the other hand, in the OCF representation the matrix \(B_o\) depends on the location \(z\) of the zero. Therefore, so does the controllability matrix, which is given by \[ \mathcal C_{(A_o, B_o)} = \MATRIX{ -z & -2 \\ 1 & -3 - z}. \] Thus, \(\det \mathcal C_{(A_o, B_o)} = z^2 + 3z + 2 = (z+1)(z+2).\)$ Thus, the OCF representation is not controllable when \(z = -1\) or \(z = -2\)!
Consider z = -1$. For this value of \(z\), the TF is given by \[ G(s) = \frac{s + 1}{(s+1)(s+2)} = \frac{1}{s+2}. \] Thus, we have a pole-zero cancellation and the OCF representation is not controllable because of that!
This also suggests that we need to refine the relationship between characteristic polynomial of \(A\) and the poles of the TF. The two are equal when there is no pole-zero cancellation. This also leads to the following definition.
A SSM model \((A,B,C)\) is called internally stable if all the eigenvalues of \(A\) lie in the OLHP.
This is equivalent to having all open loop poles like in the OLHP and no pole-zero cancellations taking place.
We conclude the discussion with some properties of controllability.
Change of coordinates does not change controllability.
Let \(T\) be an inverible matrix that changes the SSM \((A,B,C)\) to \((\tilde A, \tilde B, \tilde C)\). Then, the system \((A,B)\) is controllable if and only if \((\tilde A, \tilde B)\) is controllable (we have seen this before when we derived a formula for \(T^{-1}\).)
Invariance under state feedback
The system \((A,B)\) is controllable if and only if the system \((A - BK, B)\) is controllable for all state feedback gains \(K\).
Is there a contradiction between the first claim (change of variables doesn’t change controllability) and the pole-zero cancellation example above? No. Note that the claim is that for an invertible matrix \(T\). In the example considered in the pole-zero cancellation section, the change of coordinates that take us from CCF to OCF is given by: \[ T^{-1} = \mathcal C_{(A_o, B_o)} \mathcal C_{(A_c, B_c)}^{-1} = \MATRIX{ -2 - 3z & - z \\ -z & 1 }. \] For \(z = -1\) or \(z = -2\), the change of coordinates is not full rank!