# Setting the 3-dB Cutoff Frequency of an Exponential Averager

This blog discusses two ways to determine an exponential averager's weighting factor so that the averager has a given 3-dB cutoff frequency. Here we assume the reader is familiar with exponential averaging lowpass filters, also called a "leaky integrators", to reduce noise fluctuations that contaminate constant-amplitude signal measurements. Exponential averagers are useful because they allow us to implement lowpass filtering at a low computational workload per output sample.

Figure 1 shows two, a two-multiply and a one-multiply [1,2], exponential averagers. Given the same value for the α weighting factor, the two averagers have identical performance.

**WEIGHTING FACTOR APPROXIMATION FORMULA**

Years ago I was introduced to the following expression for computing the α weighting factor to set an averager's 3-dB cutoff frequency to *f _{c}* Hz:

where *f _{s}* is the averager's input data sample rate in Hz [1]. The “app” subscript in Eq. (1) stands for approximation. I did some Matlab modeling of Eq. (1) and found it to be useful so long as

*f*was less than roughly 0.1

_{c}*f*. I hadn't thought much more about Eq. (1) after that, thinking that it was a little-known approximation formula. However, I recently received an E-mail from a signal processing engineer asking why I didn't include Eq. (1) in the 'Averaging' chapter of my DSP book. So perhaps Eq. (1) is more widely known than I thought. That E-mail convinced me that it might be useful to write a short blog on how to design an exponential averager with a given 3-dB cutoff frequency.

_{s}**EXACT WEIGHTING FACTOR FORMULA**

The correct expression for computing the α weighting factor to set an exponential averager's 3-dB cutoff frequency to *f _{c}* Hz is [3]:

The “cor” subscript in Eq. (2) stands for correct. The derivation of the messy Eq. (2) is given in the Appendix.

So the question is, “What is the error in using the α_{app} approximate weighting factor for various values of the 3-dB cutoff frequency *f _{c}*?” Figure 2 shows the frequency magnitude and phase responses of two exponential averagers when the

*f*cutoff frequency is one tenth of the

_{c}*f*sample rate. The solid blue curves correspond to a correct α

_{s}_{cor}computed using Eq. (2). The dashed red curves correspond to an α

_{app}computed using Eq. (1).

The solid blue α_{cor} magnitude curve in Figure 2 has the desired -3 dB value at *f _{c}* = 0.1

*f*Hz. The dashed red α

_{s}_{app}magnitude curve's value at

*f*Hz is -2.86 dB. So at such a low value of

_{c}*f*, the two magnitude curves are quite similar and Eq. (1) is an acceptable approximation to Eq. (2).

_{c}When we set *f _{c}* = 0.2

*f*Hz, on the other hand, Eq. (1)'s α

_{s}_{app}falls short on performance. Figure 3 shows the performance of the two exponential averagers when

*f*= 0.2

_{c}*f*Hz. The solid blue α

_{s}_{cor}magnitude curve in Figure 3 has the desired -3 dB value at

*f*= 0.2

_{c}*f*Hz. The dashed red α

_{s}_{app}magnitude curve's value at

*f*Hz is -2.46 dB, an error of 0.54-dB (an 18% error). At this higher value of

_{c}*f*Eq. (1) is not an acceptable approximation to Eq. (2).

_{c}It turns out that the Eq. (1) approximation formula is only reasonably accurate at low values of *f _{c}*. As the

*f*cutoff frequency is increased in value the greater is the error when using Eq. (1), as shown in Figure 3.

_{c}The bottom line of this blog is that the Eq. (1) expression gives reasonably accurate results when the *f _{c}* cutoff frequency is less than 0.1

*f*. Equation (2) gives exactly correct results regardless of the

_{s}*f*value.

_{c}**REFERENCES**

[1] V. Vassilevsky, “Efficient Multi-tone Detection,” IEEE Signal

Processing Magazine, “DSP Tips & Tricks” column, March 2007.

[2] R. Lyons, “Understanding Digital Signal Processing”, 3rd

Edition, Prentice Hall Publishing, 2011, pp. 789-780.

[3] Pages 613-614 of Reference [2].

**APPENDIX A – Deriving Equation (2)**

Here's how to derive Eq. (2). The expression for the frequency magnitude response of an exponential averager is [3]:

where frequency ω is a normalized angle in the range of 0 ≤ ω ≤ π (corresponding to a continuous-time frequency range of 0 –to- *f _{s}*/2 Hz).

So the question is, "What's the expression for α, in terms of ω, so that |*H*_{exp}(ω)| = 1/sqrt(2) = 0.707?" If we square Eq. (A-1) and set |*H*_{exp}(ω)|^{2} = 0.5, we end up with:

Equation (A-2) can be written as:

Using the quadratic equation we can solve Eq. (A-3) for α as:

where ω = 2Π*f _{c}*/

*f*, and

_{s}*f*is the 3-dB cutoff frequency in Hz. Regarding the plus and minus signs before the square root, we choose to use the plus sign for Eq. (2). Choosing the negative sign in Eq. (A-4) places the exponential averager's z-domain pole outside the unit circle. This is a bad thing.

_{c}**Previous post by Rick Lyons:**

Understanding the 'Phasing Method' of Single Sideband Demodulation

**Next post by Rick Lyons:**

Coupled-Form 2nd-Order IIR Resonators: A Contradiction Resolved

## Comments:

- Comments
- Write a Comment Select to add a comment

I assume the difference equation of your filter is:

y(n) = alpha.x(n) + (1-alpha).y(n-1) corresponding to figure 1 a, two multipliers

and if rearranged becomes:

y(n) = alpha.(x(n) - y(n-1) + y(n-1) corresponding to figure 1 b, one multiplier

However, I am used to the equation as follows:

y(n) = (1-alpha).x(n) + alpha.y(n-1)

In effect similar but with alpha defined in opposite sense.

Kaz

and if rearranged becomes:

y(n) = alpha.(x(n) - y(n-1)) + y(n-1) corresponding to figure 1 b, one multiplier

Vladimir Vassilevsky showed that Figure 1(b) single-mutiply averager to me years ago. It's pretty neat. Did you see my 'Multiplierless Exponential Avetrager' blog?

[-Rick-]

I looked at your blog of multiplier-less Averager and it does correlate with my comments.

In FPGAs we are used to avoid multipliers by any means including shift multiplication(for power 2 coefficient), addition for small integer coefficient, pre-adding for symmetry etc. So the method in your blog of multiplierless approach applies in general to any case and not just the expenential averager.

But surely it suits the case as it has single coefficient in effect.

My general concept of integrators is as follows:

case(1): a simple accumulator that keeps adding up its own output with some extra bits.

case(2) as above but add up fraction of output by truncatiing few LSBs

case(3) as above but have some control over cutoff point such the alpha examples above.

case 1 may be ok for getting the mean of bipolar stream. but could easily overflow and break otherwise.

case 2 is similar to case 3 but with x(n) coefficient = 1 and y(n-1) coefficient = 1/2^n (n = number of lsbs chopped off.

case 3: Changing the sense of alpha as explained in my first comment is equivalent since then alpha will be redefined as e^fc/fs rather than 1-e^fc/fs.

Regards

Kaz

Just wandering through. It seems like equation #1 is missing a minus sign.

a = 1 - e ^ -(2*pi*fc/fs)

Cheers

Mike

To post reply to a comment, click on the 'reply' button attached to each comment. To post a new comment (not a reply to a comment) check out the 'Write a Comment' tab at the top of the comments.

Registering will allow you to participate to the forums on ALL the related sites and give you access to all pdf downloads.