Greg Stanley and Associates
 Home   About Us   Products   Services   Success Stories   Tech Resources   Contact Us 
HomeTech ResourcesFault DiagnosisFiltering > Exponential Filter >

Exponential Filter

Filtering topics:

 

This page describes exponential filtering, the simplest and most popular filter. This is part of the section
Filtering that is part of
A Guide to Fault Detection and Diagnosis..

Overview, time constant, and analog equivalent

The simplest filter is the exponential filter. It has only one tuning parameter (other than the sample interval).  It requires the storage of only one variable -- the previous output. It is an IIR (autoregressive) filter - the effects of an input change decay exponentially until the limits of displays or computer arithmetic hide it. 

In various disciplines, use of this filter is also referred to as “exponential smoothing”. In some disciplines such as investment analysis, the exponential filter is called an “Exponentially Weighted Moving Average” (EWMA), or just “Exponential Moving Average” (EMA). This abuses the traditional ARMA “moving average” terminology of time series analysis, since there is no input history that is used - just the current input.

It is the discrete time equivalent of the “first order lag” commonly used in analog modeling of continuous-time control systems. In electrical circuits, an RC filter (filter with one resistor and one capacitor) is a first-order lag. When emphasizing the analogy to analog circuits, the single tuning parameter is the “time constant”, usually written as the lower case Greek letter Tau (tau). In fact, the values at the discrete sample times exactly match the equivalent continuous time lag with the same time constant. The relationship between the digital implementation and the time constant is shown in the equations below.

Exponential filter equations and initialization

Filter

The exponential filter is a weighted combination of the previous estimate (output) with the newest input data, with the sum of the weights equal to 1 so that the output matches the input at steady state. Following the filter notation already introduced:

y(k) = a * y(k-1) + (1-a) * x(k)

where
x(k) is the raw input at time step k
y(k) is the filtered output at time step k
a is a constant between 0 and 1, normally between 0.8 and 0.99. (a-1) or a is sometimes called the “smoothing constant”.

For systems with a fixed time step T between samples, the constant “a” is calculated and stored for convenience only when the application developer specifies a new value of the desired time constant tau

a = exp (-T/tau

where tau (tau) is the filter time constant, in the same units of time as T.

For systems with data sampling at irregular intervals, the exponential function above must be used with each time step, where T is the time since the previous sample.

The filter output is usually initialized to match the first input.

As the time constant approaches 0, a goes to zero, so there is no filtering – the output equals the new input. As the time constant gets very large, a approaches 1, so that new input is almost ignored – very heavy filtering.

The filter equation above can be rearranged into the following predictor-corrector equivalent:

y(k) = y(k-1) + (1-a)*( x(k) - y(k-1) )

This form makes it more apparent that the variable estimate (output of the filter) is predicted as unchanged from the previous estimate y(k-1) plus a correction term based on the unexpected “innovation” -- the difference between the new input x(k) and the prediction y(k-1). This form is also the result of deriving the exponential filter as a simple special case of a Kalman filter, which is the optimal solution to an estimation problem with a particular set of assumptions.

Step response

One way to visualize the operation of the exponential filter is to plot its response over time to a step input. That is, starting with the filter input and output at 0, the input value is suddenly changed to 1. The resulting values are plotted below:

 

Exponential Filter Step Response

 

In the above plot, the time is divided by the filter time constant tau so you can more easily predict the results for any time period, for any value of the filter time constant. After a time equal to the time constant, the filter output rises to 63.21% of its final value. After a time equal to 2 time constants, the value rises to 86.47% of its final value. The outputs after times equal to 3,4,and 5 time constants are 95.02%, 98.17%, and 99.33% of the final value, respectively. Since the filter is linear, this means that these percentages can be used for any magnitude of the step change, not just for the value of 1 used here.

Although the step response in theory takes an infinite time, from a practical standpoint, think of the exponential filter as 98% to 99% “done” responding after a time equal to 4 to 5 filter time constants.

Variations on the exponential filter

There is a variation of the exponential filter called a “nonlinear exponential filter” [Weber, 1980], intended to heavily filter noise within a certain “typical” amplitude, but then respond more quickly to larger changes.

Copyright 2010 - 2013, Greg Stanley

Return to Filtering   Next: Moving Average Filter

Return to A Guide to Fault Detection and Diagnosis

 

Share this page: Share this page via LinkedIn... Bookmark or share this page on Delicious... Share this page by e-mailing link...    

 Home   About Us   Products   Services   Success Stories   Tech Resources   Contact Us 
Enter keywords to search this site:
Now operated by Performity LLC