Exponential Filter
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 is a low pass filter, intended to pass flow frequencies and attenuate high frequencies. 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 continuoustime control systems. In electrical circuits, an RC filter (filter with one resistor and one capacitor) is a firstorder 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 (). 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
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(k1) + (1a) * 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. (a1) 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 :
a = exp (T/) ( which is equivalent to = T/log(a) )
where (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 definitions of the filter constants here swap a for (1a) in typical forecasting literature. The reason is simply the control systems background of the author, where the most important dynamics are defined by the relationship to the previous value, not the input.
The filter equation above can be rearranged into the following predictorcorrector equivalent:
y(k) = y(k1) + (1a)*( x(k)  y(k1) )
This form makes it more apparent that the variable estimate (output of the filter) is predicted as unchanged from the previous estimate y(k1) plus a correction term based on the unexpected “innovation”  the difference between the new input x(k) and the prediction y(k1). 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.
Exponential filter 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 (Click for fullsized image)
In the step response 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. Some other examples: For a sample time T of 1 minute, a = 0.9 corresponds to = 9.49 minutes, and a = 0.998 corresponds to = 499.5 minutes.
Variations on the exponential filter
Exponential filters can be placed in series. This increases the attenuation of high frequency noise, but adds additional lag to the output as well, often too much for control loops or diagnosis.
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.
Exponential filters essentially assume a signal model of brownian motion/random walk: that the signal remains unchanged except for some random process noise. Then the best prediction of the next value (before seeing newer data) is the previous value. The final estimate is just a weighted average of the predicted value and a newlyobserved value. Different filters can be derived by making more assumptions on a model of the input signal. For instance, if the input signal can be assumed to be trending in a straight line (increasing or decreasing at a constant rate), then double exponential smoothing can be used. This applies an exponential filter not only on the input value, but also on an estimate related to the derivative of the input. See the section on double exponential smoothing.
Clustering and filtering with Real Time Exponential Filter Clustering (RTEFC
For some applications such as fault detection and isolation, or advanced control systems, it is useful to develop a set of representative system data. Some fault detection detection and isolation schemes, and some control methods such as the modelfree BDAC control method, work directly with that set. In other cases, the set is used as a training set for developing modelbased diagnosis or control. That includes neural net models, modelbased control such as MPC, and conventional regression models. A comprehensive multivariable approach was developed, called RTEFC (Real Time Exponential Filter Clustering). It combines real time clustering with exponential filtering.
Copyright 2010  2017, Greg Stanley
Return to Filtering Next: Moving Average Filter
Return to A Guide to Fault Detection and Diagnosis
