Sylib
A C++ Library For V5
|
Simple Moving Average Filter. More...
#include <math.hpp>
Public Member Functions | |
SMAFilter (int sampleSize) | |
Creates a Simple Moving Average filter. More... | |
double | filter (double rawValue) |
Filters an input value. More... | |
int | getQueueLength () const |
Gets the current length of the queue of previous values. More... | |
int | getQueueMaxLength () const |
Gets the maximum length of the queue of previous values. More... | |
double | getCurrentTotal () const |
Gets the current sum of queue values. More... | |
double | getCurrentValue () const |
Gets the current filter output without providing a new input value. More... | |
Simple Moving Average Filter.
sylib::SMAFilter::SMAFilter | ( | int | sampleSize | ) |
Creates a Simple Moving Average filter.
sampleSize | The number of previous values to average. A higher number will result in a more stable value, but with more lag. |
double sylib::SMAFilter::filter | ( | double | rawValue | ) |
Filters an input value.
rawValue | The raw input value to filter |
double sylib::SMAFilter::getCurrentTotal | ( | ) | const |
Gets the current sum of queue values.
double sylib::SMAFilter::getCurrentValue | ( | ) | const |
Gets the current filter output without providing a new input value.
int sylib::SMAFilter::getQueueLength | ( | ) | const |
Gets the current length of the queue of previous values.
int sylib::SMAFilter::getQueueMaxLength | ( | ) | const |
Gets the maximum length of the queue of previous values.
Equal to the sample size specifiied in the constructor