Control theory - feedback control of a damped oscillator to stabilise velocity 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?
 A: 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. 
A: 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).
$$
