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

FilterRunningAverage provides an weighted running average filter More...

#include <Filter.h>

Inheritance diagram for FilterRunningAverage:
Filter FilterDoubleExponentialSmoothing

Public Member Functions

 FilterRunningAverage (double _alpha=0.5)
 
void setAlpha (double _alpha)
 
double getAlpha ()
 
double operator= (double _value)
 
virtual double next (double y)
 Update the value. All inherited classes need to update value in next().
 
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 alpha
 
bool breset
 
- Protected Attributes inherited from Filter
double value
 

Detailed Description

FilterRunningAverage provides an weighted running average filter

Note
This could be named also as FilterSingleExponentialSmoothing

The FilterRunningAverage calculates a simple running average using the weight value alpha.

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

If alpha is larger (near 1.0) the average reacts faster for changes and if it is near 0.0 then it reacts slowly. The weight value alpha may be set in the constructor or with setAlpha() .

Definition at line 202 of file Filter.h.


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