My Project
Public Member Functions | Protected Attributes | List of all members
FilterDoubleExponentialSmoothing Class Reference

FilterDoubleExponentialSmoothing provides an weighted running average filter More...

#include <Filter.h>

Inheritance diagram for FilterDoubleExponentialSmoothing:
FilterRunningAverage Filter

Public Member Functions

 FilterDoubleExponentialSmoothing (double _alpha=0.5, double _gamma=1.0)
 
void setGamma (double _gamma)
 
double getGamma ()
 
double operator= (double _value)
 
virtual double next (double y)
 Update the value. All inherited classes need to update value in next().
 
- Public Member Functions inherited from FilterRunningAverage
 FilterRunningAverage (double _alpha=0.5)
 
void setAlpha (double _alpha)
 
double getAlpha ()
 
double operator= (double _value)
 
virtual void reset ()
 Reset the filter state.
 
- Public Member Functions inherited from Filter
 Filter ()
 Constructor.
 
double get () const
 Get the latest value.
 
 operator double ()
 Get the latest value.
 

Protected Attributes

double gamma
 
double slope
 
- Protected Attributes inherited from FilterRunningAverage
double alpha
 
bool breset
 
- Protected Attributes inherited from Filter
double value
 

Detailed Description

FilterDoubleExponentialSmoothing provides an weighted running average filter

The FilterDoubleExponentialSmoothing calculates a simple running average for both the average and slope using the weight values alpha and gamma.

value = ((1.0-alpha) * (value + slope)) + (alpha * (double)y);
slope = ((1.0-gamma) * (slope)) + (gamma * (value - value_prev));

If the weight values (alpha , gamma) are larger (near 1.0) the formulas react faster for changes and if they are near 0.0 then the reaction is slower. The weight values alpha and gamma may be set in the constructor or with setAlpha() and setGamma() .

Definition at line 248 of file Filter.h.


The documentation for this class was generated from the following file: