# Find a general control and then show that this could have been achieved at x2

Determine the general form of $u_0, u_1 ~\text{and} ~ u_2$ if a system of difference equations of the form

$$x_{n+1} = Ax_n + Bu_n,$$

where:

$$A = \begin{pmatrix} 3 & 2 & 2 \\ -1 & 0 & -1 \\ 0 & 0 & 1 \end{pmatrix}$$

and:

$$B = \begin{pmatrix} 0 & 0 \\ 0 & 1 \\ 1 & 0 \end{pmatrix}$$

is to be controlled for $x_0 = 0 ~ to ~ x_3 = [2, 1, 2]^T$ .

Show this target could have been achieved at $x_2$

Solution So far I have caculated the controlability matrix to be $$C =\begin{pmatrix} 0&0&2&2&6&6\\ 0&1&-1&0&-3&-2\\ 1&0&1&0&1&0 \end{pmatrix}.$$ Thus the system is controlable Now putting Cv=x3 i have the 3 equations $$2c+2d+6e+6f=2\\ b-c-3e-2f=1\\ c+e+f=2\\$$ which i have then put into augmented matrix row echleon form which i have found to be $$a-d-2e-3f=1\\ b+d+f=2\\ c+d+3e+3e=1\\$$

How do I now solve with so many unknowns? also can you please check my working so far is correct. many thanks

-
@WG- Can you confirm what you think the general form of $u_0, u_1,$ and $u_2$ is? do you agree with \begin{align} u_0 &= \begin{bmatrix}1-3r_3 +2r_2 +r_1 \\ 2-r_1 -r_3\end{bmatrix} \\ u_1 &= \begin{bmatrix}1-3r_3 -3r_2 -r_1 \\ r_1\end{bmatrix} \\ u_2 &= \begin{bmatrix}r_2 \\ r_3\end{bmatrix} \end{align} – user67298 Mar 18 '13 at 18:32

First of all we have forall $n\in N:$ $u_{n}\in R^{2}$. So let $$u_{0}=(u_{0,1},u_{0,2})^{t}$$ be given as well as $x_{0}=0$. Then we get $$x_{1}=Ax_{0}+Bu_{0}=0+(0,u_{0,2},u_{0,1})^{t}$$ Again plugging this into the recursion we obtain $$x_{2}=Ax_{1}+Bu_{1}=A(0,u_{0,2},u_{0,1})^{t}+B(u_{1,1},u_{1,2}).$$ This has by assumption to be $x_{3}$ so you get $4$ variables to determine. The system is underdetermined, but this should be no problem since you only have to solve the linear equation $$x_{3}=A(0,u_{0,2},u_{0,1})^{t}+B(u_{1,1},u_{1,2})$$ with respect to $u_{0,1},u_{0,2},u_{1,1},u_{1,2}$.

An update to your problem. The Kalman matrix $C$ is correct. Now we want to find the vector $u:=(u_{0,1},u_{0,2},u_{1,1},u_{1,2},u_{2,1},u_{2,2})^{t}\in R^{6}$ such that $$Cu=x_{3}.$$ We can write this in matrix vector representation as $$\begin{pmatrix} 0&0&2&2&6&6&|2\\ 0&1&-1&0&-3&-2&|1\\ 1&0&1&0&1&0&|2 \end{pmatrix}$$ By changing rows and dividing by 2 $$\begin{pmatrix} 1&0&1&0&1&0&|2\\ 0&1&-1&0&-3&-2&|1\\ 0&0&1&1&3&3&|1\\ \end{pmatrix}$$ This system is in echelon form. So we first determine one specifical solution, for instance $$u^{*}=\begin{pmatrix} 2\\1\\0\\1\\0\\0\end{pmatrix}$$. Next we need the KERNEL of the matrix, that is the elements $$\operatorname{ker}(C):=\{x\in R^{6}: Cx=0\}.$$ In matrix vector representation this is $$\begin{pmatrix} 1&0&1&0&1&0&|0\\ 0&1&-1&0&-3&-2&|0\\ 0&0&1&1&3&3&|0\\ \end{pmatrix}$$ Since this matrix has $\operatorname{Rank}(C)=3$, we have to find $3$ vectors, linear independent and satisfying the kernel condition: The vectors $$v_{1}=\begin{pmatrix} 2\\0\\-3\\0\\1\\0 \end{pmatrix} \quad v_{2}=\begin{pmatrix} 0\\2\\0\\-3\\0\\1\end{pmatrix} \quad v_{3}=\begin{pmatrix} 1\\-1\\1\\-1\\-2\\2\end{pmatrix}$$ do the job, so they generate the kernel of $C$. Altogether we have as solution $$u\in\{u^{*}+\lambda v_{1}+\mu v_{2}+\sigma v_{3}, \lambda,\mu,\sigma\in R\}.$$ So if you pick a control vector $u$ in this set, you control the state to $x_{3}$.

-
Do i therefore not have to solve the 3 equations with 6 unknowns as I have done in my solution – user67298 Mar 18 '13 at 15:01
I am still looking for a solution for $u_0 u_1 and u_2$ from the original question. your answer only gives a solution to $u_0 and u_1$ – user67298 Mar 18 '13 at 15:05
Assuming your computation is right, you can simply guess a solution. As I already said there are infinitely many. You have 6 variables and only 3 equations all linear. How can you compute the solution...? It is simple linear Algebra... But I will give one solution: Set $d=e=f=0$ and compute $a, b, c$... – Alex Mar 18 '13 at 15:27
thanks however this would be specific solution where as I am looking for the general form of $$U_{1) U_{2) U_{3)$$ – user67298 Mar 18 '13 at 17:49
that is Linear Algebra :), look for a specific solution (as the one I guessed) and then compute the kernel of your $3\times 6$ matrix. Kernel + specific solution will give you every solution... – Alex Mar 18 '13 at 17:54

The reachable subspace at time $t$ is defined as $\mathcal{R}_t = \text{Im } R_t =\text{Im} \begin{bmatrix}\mathbf{B} & \mathbf{A}\mathbf{B} & \ldots & \mathbf{A}^{t-1}\mathbf{B}\end{bmatrix}$. $\text{Im}$ is the image of a matrix. The reachable space $\mathcal{R} = \lim_{t\rightarrow\infty} \mathcal{R}_t$.

$$\mathcal{R} = \left\{\begin{bmatrix} 1 \\ 0 \\ 0\end{bmatrix},\begin{bmatrix} 0 \\ 1 \\ 0\end{bmatrix},\begin{bmatrix} 0 \\ 0 \\ 1\end{bmatrix}\right\}$$

As you can see $\mathcal{R} = \mathbb{R}^3$ so we already know now that all possible points $(x,y,z) \in \mathbb{R}^3$ can be reached.

Now lets take a step backwards and look to how the controllability matrix is retrieved. We have $\mathbf{x}(t+1) = \mathbf{A}\mathbf{x}(t) + \mathbf{B}\mathbf{u}(t)$. The states which can be reached in one step are $\mathbf{x}(1) = \mathbf{B}\mathbf{u}(0)$. The states which can be reached in two steps are $\mathbf{x}(2) = \mathbf{A}\mathbf{B}\mathbf{u}(0) + \mathbf{B}\mathbf{u}(1)$. Hence the states which can be reached in $t$ steps are $\mathbf{x}(t) = \mathbf{A}^{t-1}\mathbf{B}\mathbf{u}(0) + \mathbf{A}^{t-2}\mathbf{B}\mathbf{u}(1) + \ldots + \mathbf{A}\mathbf{B}\mathbf{u}(t-2) + \mathbf{B}\mathbf{u}(t-1)$. This last equation can be rewritten from a summation to matrix form.

$$\mathbf{x}(t) = \sum_{\tau=0}^{t-1}\mathbf{A}^{t-\tau-1}\mathbf{B}\mathbf{u}(\tau) = \underbrace{\begin{bmatrix}\mathbf{B} & \mathbf{AB} & \ldots & \mathbf{A}^{t-1}\mathbf{B}\end{bmatrix}}_{R_t} \underbrace{\begin{bmatrix} \mathbf{u}(t-1) \\ \mathbf{u}(t-2) \\ \vdots \\ \mathbf{u}(0)\end{bmatrix}}_{\mathbf{\bar{u}}}$$

Now there is a theorem which states that the control $\mathbf{\bar{u}}$ needed to steer the state from $0$ to $\mathbf{x}(t) = \mathbf{\bar{x}}\in\mathcal{R}$ is equal to $\mathbf{\bar{u}} = R_t^\mathrm{T}\left(R_tR_t^\mathrm{T}\right)^{-1}\mathbf{\bar{x}}$. Note that this solution is not unique it is possible that there are more different control inputs which lead to the same state.

In your case $\mathbf{\bar{x}} = \begin{bmatrix} 2 & 1 & 2\end{bmatrix}^\mathrm{T}$. So $\mathbf{\bar{u}} = \begin{bmatrix}\begin{bmatrix}9/7 & 9/7 & 23/28\end{bmatrix}^\mathrm{T} \\ \begin{bmatrix}23/28 & -3/28 & -3/28\end{bmatrix}^\mathrm{T}\end{bmatrix}$

Matlab code:

A = [3 2 2; -1 0 -1; 0 0 1];
B = [0 0; 0 1; 1 0];
xbar = [2 1 2]';
Ctrb = ctrb(A,B);
ubar = Ctrb'*inv(Ctrb*Ctrb')*xbar
-