#### Table of Contents

#### Introduction

This blog shows how to approximate the 3 dB cutoff frequency of the moving average filter.

Check out these other blogs!

#### Moving Average Filter Impulse Response

The boxcar filter or boxcar window is an FIR filter whose weights are all 1:

(1)

The filter weights in (1) are normalized in the time domain to create a moving average (MA) filter

(2)

#### Magnitude-Squared Frequency Response

The magnitude-squared of the frequency response for the boxcar window was derived in a previous blog,

(3)

The moving average is normalized by a factor of 1/N therefore the magnitude-squared of the moving average is normalized by a factor of ,

(4)

#### Gain at Zero-Frequency (omega=0)

There are multiple bandwidth definitions (see Bandwidth Measures). The focus of this blog is the half-power or 3 dB measure. The 3 dB bandwidth in decibels is

(5)

The moving average filter is a low-pass filter whose magnitude is the maximum value at . Therefore to measure the half-energy point the maximum value has to be calculated, which is (4) at ,

(6)

#### Finding the 3 dB Bandwidth

The 3 dB bandwidth is the frequency at which the magnitude-squared is 1/2 the maximum value,

(7)

After substituting (4) equation (7) can now be written as

(8)

which is simplified to

(9)

Finding a closed-form solution for (9) is not trivial (see Wolfram’s solution when N=5), but the bandwidth can be approximated as *approximately*

(10)

Figures 1-3 show the cutoff frequency approximation (10) for N=5, 10 and 16.

The cutoff approximation (10) is not an exact value for the frequency but it is a reasonable approximation.

#### Conclusion

The moving average filter is a normalized boxcar window or boxcar filter. The 3 dB point is where the magnitude-squared is 0.5. The 3 dB bandwidth of a moving average filter length N can be approximated by .

Check out these other blogs!

## 3 Responses

This estimation approach can be used to determine the cutoff for a MA (lowpass) filter. What if I wanted to construct a MA bandpass filter from two lowpass filters? For example, if the filter length N based on the peak in the spectrum is 120 days, the low passband cutoff would be 38 days (3.14159/120=.02617, 1/.02617=38). Is there a way I cann use this estimation approach to determine the cutoff for the high passband of the MA bandpass filter?

> What if I wanted to construct a MA bandpass filter from two lowpass filters?

Are you required to use a moving average filter? It sounds like you are trying to build up a more sophisticated filter using the moving average as the foundation. I would be hesitant to do this, and I would design a band-pass filter using remez instead (see below).

The MA filter is a specific filter implementation where all of the taps are the same such that it computes the arithmetic mean of the input signal. It’s useful in some contexts but it doesn’t give you much control over the frequency response other than selecting the length N.

From what I can read into your question, it sounds like you need a band-pass filter in which you can specify the lower and upper cutoff frequency independently. If that’s the case I would design a band-pass filter with remez and skip the moving average filter. I have a blog here in which I describe how to do all of this using SciPy’s Remez function: https://www.wavewalkerdsp.com/2021/09/24/designing-fir-band-pass-filters-with-remez/

I hope this helps!

Great. I’ll take a look. Thanks.