#include <MovingAverage.h>
MovingAverage::MovingAverage |
( |
float |
startValue, |
|
|
float |
alphaOrN |
|
) |
| |
|
inline |
Constructs the moving average, starting with #startValue# as its value. The #alphaOrN# argument has two options:
- if <= 1 then it's used directly as the alpha value
- if > 1 then it's used as the "number of items that are considered from the past" (*) (*) Of course this is an approximation. It actually sets the alpha value to 2 / (n - 1)
float MovingAverage::get |
( |
| ) |
const |
|
inline |
Returns the value of the moving average.
void MovingAverage::reset |
( |
float |
startValue | ) |
|
|
inline |
Resets the moving average to #startValue#.
void MovingAverage::update |
( |
float |
v | ) |
|
|
inline |
Updates the moving average with new value #v#.
float MovingAverage::_alpha |
|
private |
float MovingAverage::_value |
|
private |
The documentation for this class was generated from the following file: