# Solving for impulse response h[n] given input-output pairs

This is a homework problem that I've worked on and I want to confirm some of my reasoning.

I'm given two sets of input-output pairs of a particular system, $S$, that we know is linear time-invariant (LTI). Given those two pairs, find the impulse response h[n] of the system:

$$x_1[n] = [1, 0, 1] * S \longrightarrow y_1[n] = [0,1,0,2,0,1]$$

$$x_2[n] = [0, 1, 1] * S \longrightarrow y_2[n] = [0,0,1,1,1,1]$$

I found a linear combination of both inputs to yield the delta:

$$\delta[n] = x_1[n] - x_2[n-1] = [1, 0, 0]$$

Due to the system being LTI, the output to the delta is:

$$y[n] = h[n] = y_1[n] - y_2[n-1] = [0,1,0,1,-1,0]$$

Since the input is 3 samples long and the output is 6 samples long, then my impulse response $h[n]$ has to be 4 samples long. So I discard the last two to finally yield:

$$h[n] = [0,1,0,1]$$

Convolving the input signals with the newly found $h[n]$ yields the given output signals. I am however uncomfortable with having to invoke the required length of $h[n]$ to yield its final form by deleting the last two samples.

Did I go wrong somewhere?

Your instinct about the truncation being fishy is correct. Your solution is indeed wrong: you just got lucky to get the correct result. As @Fat32 has pointed out, $x_1[n]-x_2[n] = {1,0,0-1}$, which is not a delta impulse and is longer than the original sequence. The result is $h[n]-h[n-3]$, and not $h[n]$.

You actually only need one set of input and output to solve this. Given the impulse response length, we know that $$y[n]=\sum_{k=0}^{3}h[k] \cdot x[n-k]$$

You can work through the sum one element at a time and solve for the new coefficient of the impulse response. Let's use $x_1$ and $y_1$ $$0 = y[0]=h[0] \cdot x[0] = h[0] \cdot 1 \rightarrow h[0] = 0$$ $$1 = y[1]=h[0] \cdot x[1] + h[1] \cdot x[0] = 0 + h[1] \cdot 1 \rightarrow h[1] = 1$$ $$0 = y[2]=h[0] \cdot x[2] + h[1] \cdot x[1] + h[2] \cdot x[0]= 0 + 0 + h[2] \cdot 1 \rightarrow h[2] = 0$$

and so forth. It's a bit tedious but will give you the right answer with a single set of input and output.

Please note that you only need the first four outputs to calculate the entire impulse response. The last two outputs are "dependent variables". If they don't come out correctly, it would mean that your system is not LTI. The second set of input and output is redundant. You can try the method on either one and should get the same result

• Thanks for the response. I later did go through the convolution such as you suggest and got the same correct answer. I initially tackled this problem graphically by trying to invoke the linearity property of the LTI system. I realize now that my mistake was in decimating values that were shifted out of the window in $x_2[n-1]$ when doing the graphical approach. Jan 24 '18 at 16:15

From the lengths of the inputs and outputs, we conclude that the length of $h$ is $4$. Hence,

$$\begin{array}{ccccccc} & h_0 & h_1 & h_2 & h_3 & 0 & 0\\ + & 0 & 0 & h_0 & h_1 & h_2 & h_3\\ \hline & 0 & 1 & 0 & 2 & 0 & 1\end{array}$$

and, thus, we obtain a system of $6$ linear equations in $4$ unknowns. The solution is $$(h_0, h_1, h_2, h_3) = \color{blue}{(0,1,0,1)}$$

There is no need to consider the 2nd input-output pair.

Without any generalizations, this particular problem could be solved with the following: Let the causal FIR impulse response of the LTI system be $h[n]$ of length $L$, which can be inferred from the first set that $L = 4$, hence let the impulse response be $$h[n] = \{a,b,c,d\}$$

Then from the first set, it can be seen that $$y[n] = h[n]+h[n-2] = \{a,b,c+a,d+b,c,d\} = \{0,1,0,2,0,1\}$$

from which you can deduce that $$a=0 ~,~ b=1 ~,~ c=0 ~,~ d=1$$ which confirms that your result was right. For a longer impulse response you would need to solve a more involved set of (linear) equations...

• Thanks for the reply! My discomfort came from the mechanics of solving the problem which initially yielded an impulse response of length 6. I knew that the impulse response had to be length 4, but felt odd about deleting the last two samples to get the real answer. Jan 24 '18 at 1:14
• indeed $\delta[n] \neq x_1[n]-x_2[n-1] = \{1,0,0,-1\}$ But your restriction on the length of $h[n]$ helps to solve the problem... is this a coincidence? elaborate more to see. Jan 24 '18 at 1:20
• I made the dumb mistake of decimating the last 1 of $x_2[n]$ when shifting it to become $x_2[n-1]$. Jan 24 '18 at 16:28
• yes I saw that. you were lucky there, but now you can compute it firmly. Jan 24 '18 at 16:38