25#ifndef MOVINGAVERAGE_H_
26#define MOVINGAVERAGE_H_
29#include "pq_moving_average.h"
44 void reset(
float initialValue);
47 virtual float update(
float v,
float alpha);
50 virtual float amend(
float previousValue,
float newValue,
float alpha) ;
53 virtual float delta(
float d);
56 float get() {
return _value; }
57 float constGet()
const {
return _value; }
An exponential moving average class.
Definition MovingAverage.h:34
MovingAverage()
Default constructor (infinite time window).
Definition MovingAverage.cpp:30
float get()
Returns the value of the moving average. This is undefined if isValid() == false.
Definition MovingAverage.h:56
virtual float delta(float d)
Applies a moving average step directly using a delta value.
Definition MovingAverage.cpp:50
void reset()
Resets the moving average.
Definition MovingAverage.cpp:34
virtual float update(float v, float alpha)
Updates the moving average with new value #v# (also returns the current value).
Definition MovingAverage.cpp:42
virtual float amend(float previousValue, float newValue, float alpha)
Amends the moving average latest update (needs to be called with same #alpha# parameter).
Definition MovingAverage.cpp:46