GY-63_MS5611/libraries/RunningAverage
2020-11-27 11:33:55 +01:00
..
examples update libraries R-Z 2020-11-27 11:33:55 +01:00
keywords.txt #149 improve accuracy of getFastAverage() 2020-04-16 12:56:15 +02:00
library.json update libraries R-Z 2020-11-27 11:33:55 +01:00
library.properties update libraries R-Z 2020-11-27 11:33:55 +01:00
LICENSE update libraries R-Z 2020-11-27 11:33:55 +01:00
performance.txt update libraries R-Z 2020-11-27 11:33:55 +01:00
README.md update libraries R-Z 2020-11-27 11:33:55 +01:00
RunningAverage.cpp update libraries R-Z 2020-11-27 11:33:55 +01:00
RunningAverage.h update libraries R-Z 2020-11-27 11:33:55 +01:00

RunningAverage

Arduino library to calculate the running average by means of a circular buffer.

Description

The RunningAverage object gives a running average of the last N numbers, giving them all equal weight. This is doen by adding new data to an internal circular buffer, removing the oldest and replace it by the newest. The size of the internal buffer

By keeping track of the _sum the runningAverage can be calculated fast (only 1 division). This is done with getFastAverage(). However the constant adding/subtracting when adding new elements introduces an accumulating error. In tests adding up to 1500000 numbers this error was always small. But that is no proof. In version 0.2.16 there is a fix added that uses the calculation of the sum in getAverage() to update the internal _sum.

Operation

See examples