# Determine impulse response with given input and output

There is a problem with LTI System. I need to find an impulse response from given input and output from stable LTI System. This is my input signal:

Input

Let I write it like a vector. $x_n = \{1, 2, 1\}$

This is my output signal:

Output

$y_n = \{0, -1, -2, 0, 2, 1\}$

I can find the length of my impulse response. $h_{\text{length}} = y_{\text{length}} - x_{\text{length}} + 1 = 4$

Based on this answer https://dsp.stackexchange.com/a/46663, I assumed that

> h_1 h_2 h_3 h_4  0   0
>  0   0  h_1 h_2 h_3 h_4
> ------------------------
> 0  -1   -2   0   2   1


where $h_1 = 0, h_2 = -1, h_3 = 2$ and $h_4 = 1$. $h_n$ must be $\{ 0, -1, 2, 1\}$

But when I check it in octave/mathlab I got a wrong convolution.

$conv([1\ 2 \ 1],[0 \ -1 \ 2 \ 1]) = [ 0 \ -1 \ 0 \ 4 \ 4 \ 1 ]$, but not $[0 \ -1 \ -2 \ 0 \ 2 \ 1]$

What am I doing wrong? Or this LTI System isn't stable?

$$\left[ \begin{array}{c c c c} 1 & 0 & 0 & 0 \\ 2 & 1 & 0 & 0 \\ 1 & 2 & 1 & 0 \\ 0 & 1 & 2 & 1 \\ 0 & 0 & 1 & 2 \\ 0 & 0 & 0 & 1 \end{array} \right] \left[ \begin{array}{c} a \\ b \\ c \\ d \end{array} \right] = \left[ \begin{array}{r} 0 \\ -1 \\ -2 \\ 0 \\ 2 \\ 1 \end{array} \right]$$
Both $a$ and $d$ are easy to find through inspection. $b$ and $c$ can be solved for by simple arithmetic. Your answer is close, but the third element should be $0$ rather than $2$.