### 3.21 How ﬁnd the impulse response of a diﬀerence equation?

Find the impulse response $$h[n]$$ for the discrete system given by the diﬀerence equation $$y[n]-\frac {1}{2} y[n-1]=x[n]-\frac {1}{4}x[n-1]$$

analytical solution:

1. The ﬁrst step is to replace $$y[n]$$ by $$h[n]$$ and $$x[n]$$ by $$\delta [n]$$ giving $h[n]-\frac {1}{2} h[n-1]=\delta [n]-\frac {1}{4}\delta [n-1]$
2. Taking the Fourier transform and assuming $$H(e^{i \omega })$$ is the Fourier transform of $$h[n]$$ results in $H(e^{i \omega })-\frac {1}{2} H(e^{i \omega }) e^{- i \omega } = 1 -\frac {1}{4} e^{- i \omega }$
3. Solving for $$H(e^{i \omega })$$ gives \begin {align*} H(e^{i \omega }) &= \frac { 1 -\frac {1}{4} e^{- i \omega } }{ 1- \frac {1}{2} e^{-i \omega } }\\ &= \frac {1}{1- \frac {1}{2} e^{-i \omega }} - \frac {1}{4} \frac { e^{-i \omega }}{1- \frac {1}{2} e^{-i \omega }} \end {align*}
4. Taking the inverse discrete Fourier transform given by $h[n]= \frac {1}{2\pi } \int _{-\pi }^{\pi } H(e^{i \omega }) e^{i \omega }$ which results in $h[n]= \left ( \frac {1}{2} \right )^n u[n] - \frac {1}{4} \left ( \frac {1}{2} \right )^{n-1} u[n-1]$

Mathematica

Clear[w, n]
expr1 = -(1/4)*Exp[-I w]/(1 - (1/2)*Exp[-I w]);
expr2 = 1/(1 - (1/2)*Exp[-I w]);
sol1 = InverseFourierSequenceTransform[expr1, w, n];
sol2 = InverseFourierSequenceTransform[expr2, w, n];
sol = sol1 + sol2



${\begin {array}{cc} -2^{-n-1} & n>0 \\ 0 & \text {True} \\ \end {array}} + {\begin {array}{cc} 2^{-n} & n\geq 0 \\ 0 & \text {True} \\ \end {array}}$

And some values of $$h[n]$$ starting from $$n=0$$ are

(sol /. n -> #) & /@ Range[0, 10]



$\left \{1,\frac {1}{4},\frac {1}{8},\frac {1}{16},\frac {1}{32},\frac {1}{64},\frac {1}{128}, \frac {1}{256},\frac {1}{512}, \frac {1}{1024},\frac {1}{2048}\right \}$