# How to calculate A and B matricies in Control Theory for my system given the ODE describing the system?

I have an ODE describing my system like so:

$\ddot{x} = -\Gamma_0\dot{x} - (\Omega_0 + u)x$

Where u is my feedback control actuator and $\Gamma_0$ and $\Omega_0$ are constants.

I want to find the $\mathbf{A}$ and $\mathbf{B}$ matrix for this system such that I have

$\dot{\vec{x}} = \mathbf{A}\vec{x} + \mathbf{B}\vec{u}$

Where $\vec{x}$ is my state vector

$\vec{x} = \begin{bmatrix} x \\ \dot{x} \\ \end{bmatrix}$

and $\vec{u} = u$

I am unsure how to proceed to get $\mathbf{A}$ and $\mathbf{B}$.

I understand that if my dynamics were non-linear I would find the fixed points of the non-linear dynamics and then linearise about that point by calculating the Jacobian of the dynamics and using this as my A matrix however I am not sure how to proceed as the actuator introduces the non-linearity.

Written as 2 first order differential equations I get

$$\begin{bmatrix} \dot{x} \\ \ddot{x} \\ \end{bmatrix} = \begin{bmatrix} 0 & 1 \\ -(\Omega_0 + u) & -\Gamma_0 \\ \end{bmatrix} \begin{bmatrix} x \\ \dot{x} \\ \end{bmatrix}$$

and I can split these up into the following 2 terms.

$$\begin{bmatrix} \dot{x} \\ \ddot{x} \\ \end{bmatrix} = \begin{bmatrix} 0 & 1 \\ -(\Omega_0) & -\Gamma_0 \\ \end{bmatrix} \begin{bmatrix} x \\ \dot{x} \\ \end{bmatrix} + \begin{bmatrix} 0\\ -x \\ \end{bmatrix} u$$

But it is my understanding that to implement control using closed-loop feedback control using $u=-\mathbf{K}\vec{x}$ the $\mathbf{A}$ and $\mathbf{B}$ must be constant matrices.

• I've added the representation of the system as a matrix of first order differential equations and the issue with doing this to implement control. – SomeRandomPhysicist Oct 23 '17 at 13:18
• My aim is to calculate the controllability matrix to check I can control the system and then define my $\mathbf{K}$ matrix in order to change the dynamics to change the position of the eigenvalues of the dynamics matrix in order to drive it to a particular desired state $\vec{x}_i$ – SomeRandomPhysicist Oct 23 '17 at 13:21
• This system is uncontrollable, its controllability matrix is zero. After linearization we obtain $B=(0,0)^T$, $U=(B,AB)=0_{2\times 2}$ – AVK Oct 23 '17 at 13:39
• Could you work through the process of linearizing of this system? – SomeRandomPhysicist Oct 23 '17 at 13:46

## 2 Answers

Denote $\bar x=(x,\dot x)$; the system is $$\dot{\bar x} = f(\dot{\bar x}),\quad f(\dot{\bar x})= \begin{bmatrix} \dot x\\ -(\Omega_0 + u)x -\Gamma_0\dot x \\ \end{bmatrix}$$ $$A=\left.\frac{\partial f}{\partial x}\right|_{\bar x=0,u=0}= \left.\left(\begin{array}{cc} 0&1\\ -(\Omega_0 + u)&-\Gamma_0 \end{array}\right)\right|_{\bar x=0,u=0}= \left(\begin{array}{cc} 0&1\\ -\Omega_0&-\Gamma_0 \end{array}\right)$$ $$B=\left.\frac{\partial f}{\partial u}\right|_{\bar x=0,u=0}= \left.\left(\begin{array}{c} 0\\ -x \end{array}\right)\right|_{\bar x=0,u=0}= \left(\begin{array}{c} 0\\ 0 \end{array}\right)$$ The controllability matrix is equal to $$U=(B,AB)=\left(\begin{array}{cc} 0&0\\ 0&0 \end{array}\right)$$

• Thanks, the process of linearizing this non-linear system makes sense to me now. – SomeRandomPhysicist Oct 23 '17 at 14:48
• If you define a new input to the system as $v = x\,u$, then that system would be controllable. So if you find a control law for $v$ you can find the actual input with $u = v / x$, which indeed has a singularity at $x=0$. However if you can ensure that your system never reaches such a state, then it wouldn't be a problem. Or if $\dot{x}\neq0$ whenever $x=0$ you could briefly set $u=0$ whenever that happens, assuming that staying at $x=0$ is not your goal. Note, this also assumes perfect knowledge of the state. – Kwin van der Veen Oct 23 '17 at 18:12

An alternative approach, which does not require you to go to the state space formulation is as follows. First, rewrite the ODE such that everything is on one side of the equation. Then we can rewrite the ODE as:

$$\Phi(\ddot{x},\dot{x},x,u)=\ddot{x} +\Gamma_0\dot{x} + (\Omega_0 + u)x=0.$$

In order to linearize the ODE we need to evaluate the Taylor series of $\Phi$. It is given by:

$$\Phi(\ddot{x},\dot{x},x,u)\approx\left.\Phi(\ddot{x},\dot{x},x,u)\right|_{\text{eq}}+\left.\dfrac{\partial \Phi}{\partial \ddot{x}}\right|_{\text{eq}}\left[\ddot{x}-\left.\ddot{x}\right|_{\text{eq}} \right]+\left.\dfrac{\partial \Phi}{\partial \dot{x}}\right|_{\text{eq}}\left[\dot{x}-\left.\dot{x}\right|_{\text{eq}} \right]$$ $$+\left.\dfrac{\partial \Phi}{\partial x}\right|_{\text{eq}}\left[x-\left.y\right|_{\text{eq}} \right]+\left.\dfrac{\partial \Phi}{\partial u}\right|_{\text{eq}}\left[u-\left.u\right|_{\text{eq}} \right]=0.$$