Calculates an approximation of the variance and standard deviation for a window of recent inputs. More...
#include <RollingStat.h>
Public Member Functions | |
| RollingStat () | |
| Constructor. | |
| void | update (T x) |
| Update the mean and variance given a new input value. More... | |
| void | update (int8_t x) |
| Update the mean and variance given a new input value. More... | |
| T | getMean () const |
| Return the mean of the last WINDOW_LENGTH number of inputs. More... | |
| T | getVariance () const |
| Return the approximate variance of the last WINDOW_LENGTH number of inputs. More... | |
| T | getStandardDeviation () const |
| Return the approximate standard deviation of the last WINDOW_LENGTH number of inputs. More... | |
Calculates an approximation of the variance and standard deviation for a window of recent inputs.
| T | the type of numbers to use. Choose unsigned int, int , uint8_t, int8_t, or float |
| WINDOW_LENGTH | how many recent input values to include in the calculations. |
Definition at line 25 of file RollingStat.h.
|
inline |
Return the mean of the last WINDOW_LENGTH number of inputs.
Definition at line 58 of file RollingStat.h.
|
inline |
Return the approximate standard deviation of the last WINDOW_LENGTH number of inputs.
Definition at line 75 of file RollingStat.h.
|
inline |
Return the approximate variance of the last WINDOW_LENGTH number of inputs.
Definition at line 68 of file RollingStat.h.
|
inline |
Update the mean and variance given a new input value.
| x | the next input value |
Definition at line 38 of file RollingStat.h.
|
inline |
Update the mean and variance given a new input value.
| x | the next input value |
Definition at line 48 of file RollingStat.h.