![]() |
My Project
|
FilterAverage provides an average filter More...
#include <Filter.h>
Public Member Functions | |
FilterAverage (int size=3) | |
void | setWindowSize (int size) |
int | getWindowSize () |
int | getCurrentSize () |
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. | |
double | deviation () const |
![]() | |
Filter () | |
Constructor. | |
double | get () const |
Get the latest value. | |
operator double () | |
Get the latest value. | |
Protected Member Functions | |
void | push_to_buffer (double y) |
Protected Attributes | |
unsigned int | count |
unsigned int | window_size |
std::deque< double > | buffer |
![]() | |
double | value |
FilterAverage provides an average filter
The FilterAverage remembers window_size last elements in the time series and returns always the average of these elements. The size of the window window_size can be set in the constructor or with setWindowSize() .
Note, that when the window_size is <= 0 we calculate the average over the whole sequence without using the buffer.