# Impulse Response of a Moving Average System

According to Discrete Time Signal Processing by Al Oppenheim 3rd Edition, the impulse response of a moving average filter is as below My question is that shouldn't h[n] be having the dirac delta function instead of the unit function u[n] (See Eq 2.9). This is mentioned in example 2.3 of the same book • It shouldn't be too surprising that there are several equivalent representations of the same impulse response. Just draw the impulse response and make sure you can see how these two representations are equivalent. Nov 26, 2019 at 7:51

Taking Equation $$2.74$$ from Example $$3$$ and setting $$M_1=0$$ gives:

$$h[n] = \frac{1}{M_2+1} \sum_{k=0}^{M_2} \delta[n-k]$$

Now lets take a closer look at this: $$h[n]$$ is non-zero only for certain values of $$n$$. Its a good a starting point as any, so lets look at $$n=0$$. We have:

$$h = \frac{1}{M_2+1} \bigg( \delta + \delta[-1] + ... + \delta[-M_2] \bigg) = \frac{1}{M_2+1}$$

For $$n=1$$, we have:

$$h = \frac{1}{M_2+1} \bigg( \delta + \delta + ... + \delta[1-M_2] \bigg) = \frac{1}{M_2+1}$$

For $$n=2$$, we have:

$$h = \frac{1}{M_2+1} \bigg( \delta[-2] + \delta[-1] + \delta+ ... + \delta[2-M_2] \bigg) = \frac{1}{M_2+1}$$

And this pattern continues, the only non-zero value, $$\delta$$, percolates through until $$n=M_2$$, then we have:

$$h[M_2] = \frac{1}{M_2+1} \bigg( \delta[-M_2] + \delta[-M_2+1] + ... + \delta \bigg) = \frac{1}{M_2+1}$$

And for $$n = M_2 + 1$$:

$$h[M_2+1] = \frac{1}{M_2+1} \bigg( \delta[-M_2-1] + \delta[-M_2] + ... + \delta[-1] \bigg) = 0$$

And you can see, for all $$n > M_2$$, $$h[n]=0$$. So, altogether we can write $$h[n]$$ as equal to $$\frac{1}{M_2+1}$$ for $$n \in [0, M_2]$$ and zero otherwise.

All Equation $$2.90$$ does is treats the summation of impulses (from Equation $$2.74$$) as unit step functions, a very useful trick! Since $$h[n]$$ starts at $$n=0$$ and ends at $$n=M_2$$ we do: $$u[n]-u[n-M_2-1]$$ to get a length $$M_2$$ box car, then scale it by $$\frac{1}{M_2+1}$$ to get the right amplitude. Hope this helps!