I have been studying about exponential average. There are enough explanations about this at Internet, but they do not explain about the time constant.

I have one channel with a $T$ seconds time signal with sampling frequency $f_s$.

If I want to do average of this time signal, we need to use either linear or exponential method. Linear average method is quite simple so there is no trouble for applying. However, if I try to apply exponential average method, there are some problems.

If time signal varies quickly, we prefer to use fast time constant 125 ms. Also, the time signal varies slowly, using 1000 ms of slow time constant is better, but in this situation, I do not know how can I apply this time constant with time signal.

Is there any explanation or any example for doing exponential average with time constant?

  • 1
    $\begingroup$ I'm not quite sure what you're asking? Are you asking "How do I apply exponential averaging?" ? Or are you asking "How to I change the time constant that I am using when I do exponential averaging?" ? Or are you asking both questions? $\endgroup$
    – Peter K.
    Aug 30, 2013 at 12:37

1 Answer 1


Exponential averaging is performed using a first order IIR filter according to the difference equation: \begin{equation} y[n] = (1-\alpha)\;x[n]+\alpha \; y[n-1] \end{equation} where $x[n]$ and $y[n]$ are the input and output signals at time $n$ and the value of the single coefficient $\alpha$ is given by the equation: \begin{equation} \alpha = \exp( \frac{-1}{f_s \tau} ) \end{equation} where $f_s$ is the sampling frequency and $\tau$ is the time constant.

In this light, it can be seen that exponential averaging filters are simply low-pass filters, the roll-off of which is -6dB/oct. The only free parameter is the cut-off frequency, which is specified by the time constant. Longer time constants will yield a lower cut-off frequency, as can be see in the Matlab code and plot below.

figure; hold all
fs = 8000;
tau = 10.^(-1:-1:-4);
alpha = exp(-1/fs./tau);
color = 'brgc';
for index = 1 : length( alpha )
    [Hz fVec] = freqz( [1-alpha(index)], [1 -alpha(index)], 8192, fs );
    plot( fVec, 20*log10(abs(Hz)), color(index), 'LineWidth', 2 );    
    legText{index} = sprintf( '$\\tau = 10^{%d}$', log10(tau(index)) );    
hLeg = legend(legText,3);
set( hLeg, 'interpreter', 'latex' );
axis( [8000/8192 4000 -70 10] )
ylabel('Amplitude [dB]')
xlabel('Frequency [Hz]')
set( gca, 'xscale', 'log' )

Different exponential averaging filters.

Notice the parallel -6dB/oct slopes (characteristic of single pole filters) and the falling cut-off frequency with lengthening time constants.

The correct choice of time constant depends on how fast the variation of the desired average is. In order to capture a quickly varying mean, only signal content above the fastest frequency of variation should be attenuated -- the time constant should be chosen accordingly. This means that if the signal mean varies very slowly, long time constants are needed, and vice versa. I find that trial and error works best to determine the optimal value, but formulas to calculate the cut-off frequency do exist, e.g. see this link.

Good luck!

  • $\begingroup$ Thank you for your help!! Really great and kind answer. :) Yeah, I am supposed to use above method in near future! thank you! $\endgroup$
    – actlee
    Aug 31, 2013 at 13:41

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.