Moving average filter experiment

This is one of my old experiments I did when I started to learn about digital signal processing. I was intrigued by the simplicity of a moving average filter and did an experiment on frequency response of a moving average filter vs. number of averaging elements.

I found out that is has somewhat a cosine frequency response, and does have excellent low pass characteristics, although have some little curves on higher frequencies.

Here is the response vs. number of averaging elements. I plotted the surface with Number of Averaging Elements/Sampling rate. That way it’s easier to realize the duration of averaging.

Here is the MATLAB program that generates this surface plot,

I also put a sound files through my moving average filter. I don’t exactly remember the number-of-averaging-elements I used but the low pass characters was very impressive. You can use Windows Media Player Bar spectrum analyzer visualization to visualize that, or you can use a good pair of headphones/ speakers to see the difference.

Here is the real sound file and

Here is the filtered sound file