According to Discrete Time Signal Processing by Al Oppenheim 3rd Edition, the impulse response of a moving average filter is as below enter image description here

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 enter image description here

  • 1
    $\begingroup$ 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. $\endgroup$
    – Matt L.
    Nov 26, 2019 at 7:51

1 Answer 1


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[0] = \frac{1}{M_2+1} \bigg( \delta[0] + \delta[-1] + ... + \delta[-M_2] \bigg) = \frac{1}{M_2+1}$$

For $n=1$, we have:

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

For $n=2$, we have:

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

And this pattern continues, the only non-zero value, $\delta[0]$, 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[0] \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!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.