0

I have this linear system

$$\begin{bmatrix} cY(t-1)\\ acY(t-1) - acY(t-2)\end{bmatrix} = T \begin{bmatrix} Y(t-2)\\ Y(t-1)\end{bmatrix}$$

where both $c$ and $a$ are known constants, and I need to find matrix $T$, which is the transformation matrix that transforms the first vector into the second one.

Doing it by hand, this could be seen like

$$\begin{bmatrix} c Y(t-1) + 0 Y(t-2) = u Y(t-1) + v Y(t-2)\\ a c Y(t-1) - a c Y(t-2) = w Y(t-1) + z Y(t-2)\end{bmatrix}$$

with

$$T = \begin{bmatrix} u & v \\ w & z\end{bmatrix} = \begin{bmatrix} 0 & c \\ -ac & ac\end{bmatrix}$$

What I need to do is to solve this in MATLAB, given both $x$ and $b$ vectors, but I can only find how to solve the system for $x$, which is not what I need.

Do you have hints on this?

EDIT: Following given answer I, I may be doing something wrong since the result is not the expected one.

This is what I did to test if I got everything correctly

syms y_t1 y_t2 t1 t2 t3 t4
T = solve(kron([y_t2 y_t1], eye(2))*[t1; t2; t3;t4]==[c_v*y_t1; (a_v*c_v)*(y_t1 - y_t2)], [t1 t2 t3 t4])

The results are:

> T.t1 = (2600102520265675*y_t1)/(144115188075855872*y_t2)
> T.t2 = (6656262451880127*y_t1 - 6656262451880127*y_t2)/(36893488147419103232*y_t2)
> T.t3 = 0
> T.t4 = 0

What am I doing wrong?

StepTNT
  • 115
  • 4

1 Answers1

1

$$\begin{bmatrix} c Y(t-1)\\ a c Y(t-1) - a c Y(t-2)\end{bmatrix} = \underbrace{\begin{bmatrix} 0 & c\\ - ac & ac\end{bmatrix}}_{=T} \begin{bmatrix} Y(t-2)\\ Y(t-1)\end{bmatrix}$$

If you have a system $T y = b$, where $y$ and $b$ are known and $T$ is the unknown, then use vectorization to solve for $T$

$$(y^T \otimes I_2) \operatorname{vec} (T) = b$$

where $y^T \otimes I_2$ is a $2 \times 4$ matrix and $\operatorname{vec} (T)$ is a $4$-dimensional column vector. In MATLAB, use function kron to do the Kronecker product $\otimes$ and reshape to vectorize. Since the $(1,1)$-th entry of $T$ is $0$, then remove the first unknown from this linear system, which yields an underdetermined system of $2$ linear equations in $3$ unknowns.

Since $T$ is only $2 \times 2$, we can solve the linear system by hand. Note that

$$T = \begin{bmatrix} 0 & c\\ - ac & ac\end{bmatrix} = c \begin{bmatrix} 0 & 1\\ - a & a\end{bmatrix} = c \begin{bmatrix} 1 & 0\\ 0 & a\end{bmatrix} \begin{bmatrix} 0 & 1\\ - 1 & 1\end{bmatrix}$$

Hence, $T y = b$ becomes

$$c \begin{bmatrix} 1 & 0\\ 0 & a\end{bmatrix} \begin{bmatrix} y_2\\ y_2 - y_1\end{bmatrix} = \begin{bmatrix} b_1\\ b_2\end{bmatrix}$$

Solving for $a$ and $c$, we obtain

$$a =\frac{b_2}{b_1} \left(\frac{y_2}{y_2- y_1}\right), \qquad{} c= \frac{b_1}{y_2}$$

  • To be honest I don't understand your answer. I need to find T with MATLAB, the provided one in the question was computed by hand. – StepTNT May 21 '16 at 10:22
  • @StepTNT I have updated my answer. – Rodrigo de Azevedo May 21 '16 at 10:25
  • I suggest to stress the dimensions of all components of the linear system for $T$ and to write out the MATLAB commands explicitly. Just in case that this is the OP's first encounter with the Kronecker product. – Carl Christian May 21 '16 at 10:38
  • I've updated the question. And yes, I never encountered the Kronecker product since I never deal with math, but this one's a special case. – StepTNT May 21 '16 at 10:43
  • @StepTNT Why are you using the symbolic toolbox? – Rodrigo de Azevedo May 21 '16 at 10:48
  • @CarlChristian Please let me know if you agree with my latest edit. – Rodrigo de Azevedo May 21 '16 at 10:50
  • I'm using one of my University's pcs and the toolbox was already installed, I don't know how to disable it (and if I'm allowed to), so I'm just using what I have. – StepTNT May 21 '16 at 10:55
  • @RodrigodeAzevedo: Everything you have written is perfectly correct. In general, what I find challenging at math.stackexchange is to grasp exactly what the OP's situation and find the right words. This is much easier in person. I have already upvoted your answer. I think explicit MATLAB commands might be beneficial here. – Carl Christian May 21 '16 at 11:07
  • @StepTNT I edited my answer again. – Rodrigo de Azevedo May 21 '16 at 11:07
  • @CarlChristian Unfortunately, I don't have MATLAB in this machine and would rather not post code that I haven't used myself. However, the matrix is only $2 \times 2$, so I found the solution by hand. I updated my answer again. – Rodrigo de Azevedo May 21 '16 at 11:11
  • 1
    @RodrigodeAzevedo Sound philosophy. You have already gone beyond the call of duty :) – Carl Christian May 21 '16 at 11:15
  • I think I may have added some confusion here. I already solved it by hand, what I'm looking for is a way to automatically do it with MATLAB (and symbolic toolbox). And given that both $a$ and $c$, as stated in the question, are known constants, I don't need to solve this for $a$ or $c$. I just need to find $T$ without doing it by hand abd without knowing how it will look in the end. If this can help, the question can be summarized as: "I have $Ax=b$ and I know $x$ and $b$, how can I find $A$ with MATLAB? – StepTNT May 21 '16 at 11:16
  • @StepTNT Solving $A x = b$ for $A$ can be done solving the linear system $(x^T \otimes I) \operatorname{vec} (A) = b$. – Rodrigo de Azevedo May 21 '16 at 11:20