I am looking at applying some simple control theory to a damped oscillator.

If I have the following dynamics

\begin{equation} \begin{bmatrix} \dot{x}\\ \ddot{x} \\ \end{bmatrix} = \begin{bmatrix} 0 & 1 \\ -\omega^2 & -\Gamma \end{bmatrix} \begin{bmatrix} x\\ \dot{x} \\ \end{bmatrix} + \begin{bmatrix} 0\\ \dfrac{1}{m} \\ \end{bmatrix} u \end{equation}

Such that my $A$ matrix is $\begin{bmatrix} 0 & 1 \\ -\omega^2 & -\Gamma \end{bmatrix}$ and by B matrix is $ \begin{bmatrix} 0\\ \dfrac{1}{m} \\ \end{bmatrix}$ and my control is $u$, an external force on the oscillator.

I can calculate the controllability matrix

\begin{equation} \mathcal{C} = \begin{bmatrix} 0 & \dfrac{1}{m} \\ \dfrac{1}{m} & -\dfrac{\Gamma}{m} \\ \end{bmatrix} \label{controllability_matrix} \end{equation}

which has rank 2. This means the controllability matrix has full column rank, this means, as I understand it, that this system is controllable. This means that we can arbitrarily place the eigenvalues (also sometimes called poles) of the system dynamics by tuning $\mathbf{K}$ in $u = -\mathbf{K}\vec{x}$ because the system dyamics becomes $\dot{\vec{x}} = (\mathbf{A} - \mathbf{B}\mathbf{K})\vec{x}$. This also means we have reachability, meaning we can drive the system to any state, the reachable set of states $R_t = \left\{ \xi ~\epsilon ~\mathbb{R}^n \right\}$.

If I then plug in $u = -K\vec{x}$ where I change $\vec{x}$ to $\vec{x}-\vec{x_t}$ where $\vec{x_t}$ is my target state I want to set the system to be driven towards.

\begin{equation} \begin{bmatrix} \dot{x}\\ \ddot{x} \\ \end{bmatrix} = \begin{bmatrix} 0 & 1 \\ -\omega^2 & -\Gamma \end{bmatrix} \begin{bmatrix} x\\ \dot{x} \\ \end{bmatrix} - \begin{bmatrix} 0\\ \dfrac{1}{m} \\ \end{bmatrix} \begin{bmatrix} K_0 & K_1 \\ \end{bmatrix} \begin{bmatrix} x - x_t \\ \dot{x} - \dot{x}_t \\ \end{bmatrix} \end{equation} which results in

\begin{equation} \begin{bmatrix} \dot{x}\\ \ddot{x} \\ \end{bmatrix} = \begin{bmatrix} 0 & 1 \\ -\omega^2 & -\Gamma \end{bmatrix} \begin{bmatrix} x\\ \dot{x} \\ \end{bmatrix} - \begin{bmatrix} 0\\ \dfrac{1}{m}K_0(x-x_t) + \dfrac{1}{m}K_1(\dot{x}-\dot{x}_t) \\ \end{bmatrix} \end{equation}

However when I put in some values for $\omega$, $\Gamma$ and $m$ and calculate the K matrix by setting the eigenvalues to be $n\times eig(A)$ [where n>1, the larger n is than 1 the more aggressive the feedback, I've used values like 1.5, 2, 3 ... etc ](this was just an initial guess - I wasn't sure where to place the eigenvalues to start - other than that they want to have a negative real value for stability and the more negative they are the more aggressive the feedback) by using K = place(A, B, eigs(A)*n) in matlab then I get a K matrix where $K_1$ is 0, and therefore I cannot control $\dot{x}$, why is this and how can I control $\dot{x}$?

I've been able to simulate this the see that it can control $x$.

Also, is it possible to set the system to be driven to any state by this control? It doesn't make sense that the system could be prepared in a state such as $x = 5cm$, $\dot{x} = 5m/s$ stably for example, as the positive velocity means it won't stay at $x = 5cm$. How can I calculate what states are reachable and stable?


2 Answers 2


There are two equations in your system, $\frac{d}{dt}x=\dot x$ and $\frac{d}{dt}\dot x=-\omega^2x-\Gamma \dot x+u/m$. The control can only affect the second equation, the first one, whether we like it or not, is satisfied anyway. It means that it is impossible to stabilize the "solution" $x=5$, $\dot x= 5$: it is not a solution of the system. It violates the system's dynamics.

The only possible solutions are $$\tag{1} x=x_t(t),\quad \dot x= \dot x_t(t). $$ In particular, if $x_t(t)=const$, then $\dot x_t$ must be zero. Any solution of the form (1) can be stabilized. But there is one point.

Suppose we want to stabilize the trajectory (1). Introduce the error $$ e(t)= x(t)-x_t(t),\quad \dot e= \dot x(t)-\dot x_t(t). $$ The error dynamics is $$ \frac{d}{dt}e= \dot e, $$ $$ \frac{d}{dt}\dot e=\ddot x(t)-\ddot x_t(t)= -\omega^2x-\Gamma \dot x+u/m-\ddot x_t(t) $$ $$ =-\omega^2(e+x_t(t))-\Gamma (\dot e+\dot x_t(t))+u/m-\ddot x_t(t) $$ $$ =-\omega^2 e-\Gamma \dot e+u/m-\ddot x_t(t) -\omega^2 x_t(t)-\Gamma \dot x_t(t) $$ Please notice the terms $-\ddot x_t(t)-\omega^2 x_t(t)-\Gamma \dot x_t(t)$. They do mean that if $x_t(t)$ is not a solution of the uncontrolled system (in other words, $\ddot x_t(t)\not\equiv -\omega^2 x_t(t)-\Gamma \dot x_t(t)$), then the control $u=-Ke$ does not, in general, stabilize it. The correct stabilizing control is $$ u=m\left( (\omega^2-c_0)e+(\Gamma-c_1)\dot e+\ddot x_t(t)+\omega^2 x_t(t)+\Gamma \dot x_t(t) \right), $$ where $c_0$, $c_1$ are some positive constants, or $$ u=-Ke+m(\ddot x_t(t)+\omega^2 x_t(t)+\Gamma \dot x_t(t)), $$ $$ K=-\left(m(\omega^2-c_0),m(\Gamma-c_1)\right). $$

  • $\begingroup$ I've just had the time to work through this and it makes sense to me now, that you have to do this such that $\dfrac{d\dot{e}}{dt} = 0$ when $e =0$ and $\dot{e} = 0$ which means the system stable at $x = x_t$ and $\dot{x} = \dot{x}_t$ (although in practise for $x = x_t$ to be stable $\dot{x}_t$ must be 0 and for $\dot{x} = \dot{x}_t$ to be stable $x$ cannot be constant). How do I calculate the values of $c_0$ and $c_1$ to use for this control? $\endgroup$ Mar 19, 2018 at 17:01
  • $\begingroup$ @SomeRandomPhysicist $c_0$ and $c_1$ are the coefficients of the closed-loop error system $\ddot e+c_1\dot e+c_0 e=0$. This system is asymptotically stable iff $c_0>0$ and $c_1>0$. $\endgroup$
    – AVK
    Mar 20, 2018 at 2:47

You must have failed in your code

>> A=[0 1;-rand(1) -rand(1)];
>> B=[0;rand(1)];
>> K = place(A,B,3*eig(A))

K =

   51.3265   14.2659

Controllability does not require that you stay at the state, only that you can reach it.

  • $\begingroup$ The problem appears to be that Gamma is very low relative to the frequency such that A effectively becomes A=[0 1;-rand(1) 0]. $\endgroup$ Feb 28, 2018 at 17:09
  • $\begingroup$ Is there a way around this other than using a lower frequency? $\endgroup$ Feb 28, 2018 at 17:13
  • 1
    $\begingroup$ Being physical does not mean good. I should not measure the amount of Watts I need when working on an atomic level, as floating-point numerics will kill all computations at that level. $\endgroup$ Feb 28, 2018 at 17:58
  • 1
    $\begingroup$ However, it feels like you perhaps have a poor control structure. If you want to control velocity, and use simple state-feedback, you will have steady-state error if you only feedback the error (for constant velocity, should $u$ be zero?...) $\endgroup$ Feb 28, 2018 at 17:59
  • 1
    $\begingroup$ You typically use $u = u^* - K(x-x^*)$ where $u^*$ is the steady-state control related to the steady-state $x^*$, i.e. the solution to $0 = Ax^*+Bu^*$ (using standard state-space notation so $x$ is the state-vector) $\endgroup$ Feb 28, 2018 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.