# Computing impulse response for system with feedback terms

I'm trying to compute the impulse response for the following system:

$$y(n) = \frac{1}{2} \left( x(n) + x(n-1) \right) + \frac{1}{2} y(n-1)$$

and am told to assume that $y(-1)=0$.

My solution: Letting $x(n) = \delta(n)$, we have

$$h(n) = \frac{1}{2}\left(\delta(n) + \delta(n-1)\right) + \frac{1}{2}h(n-1).$$

Plugging in a few values for $n$ (and assuming that $h(-1)=0$), I've obtained:

$$h(0) = \frac{1}{2},$$

$$h(1) = \frac{1}{2} + \frac{1}{2} \cdot \frac{1}{2} = \frac{3}{4}$$

and

$$h(2) = \frac{1}{2} + \frac{1}{2} \cdot \frac{3}{4} = \frac{3}{8}.$$

From this, I've observed that

$$h(n) = \begin{cases} 0, & n<0 \\ \frac{1}{2}, & n=0 \\ \frac{1}{2} + \left(\frac{1}{2}\right)^n, & n > 0 \end{cases}$$

Does this seem correct? I feel like I made a mistake somewhere and that the expression for $h(n)$ should be in a simpler form.

Note: I computed the impulse response by taking the Fourier Transform and then plugging in values for $n$ and got something different than this. However, I believe that this discrepancy is due to the initial condition $y(-1)=0$.

Your values for $h(0)$, $h(1)$ and $h(2)$ are correct. However, the general formula isn't. It should be

$$h(n) = \begin{cases} 0, & n<0 \\ \frac{1}{2}, & n=0 \\ \frac{3}{2}\left(\frac{1}{2}\right)^n, & n > 0 \end{cases}$$

A simple way to solve such problems is to use the $\mathcal{Z}$-transform:

$$Y(z)=\frac{1}{2}X(z)(1+z^{-1})+\frac{1}{2}Y(z)z^{-1}$$

which gives

$$H(z)=\frac{Y(z)}{X(z)}=\frac{1}{2}\frac{1+z^{-1}}{1-\frac{1}{2}z^{-1}}= \frac{1}{2}\frac{1}{1-\frac{1}{2}z^{-1}}+\frac{1}{2}\frac{z^{-1}}{1-\frac{1}{2}z^{-1}}$$

With the transform pair

$$\frac{1}{1-az^{-1}}\Longleftrightarrow a^nu(n),\quad |a|<1$$

and with the property

$$x(n-1)\Longleftrightarrow z^{-1}X(z)$$

you arrive at

$$h(n)=\frac{1}{2}\left(\frac{1}{2}\right)^nu(n)+\frac{1}{2}\left(\frac{1}{2}\right)^{n-1}u(n-1)$$

which corresponds to above result.

• Thanks for the clarification. I mistyped when writing my question. – Nathan Green Apr 25 '14 at 7:21

The line $h[2] = \dots$ should be $h[2] = \frac{1}{2}h[1]$

You can use the z-transform to derive the inpulse response: $x[n] = \delta[n] \Rightarrow X(z) = 1$ $Y(z) = .5 (1+z^{-1}) + .5 Y(z) z^{-1} \Rightarrow Y(z) = .5 \frac{1+z^{-1}}{1-.5z^{-1}} = .5 \left( \frac{1}{1-.5z^{-1}} + z^{-1}\frac{1}{1-.5z^{-1}} \right)$ $\Rightarrow y[n] = .5 \left( .5^{n} u[n] + .5^{n-1} u[n-1] \right)$, Where $u[n]$ is the heaviside step function.

See wikipedia for transform pairs.