A 10-Point moving average filter that returns a float each time a new value is added to the moving average array.
Fork of MovingAverageFilter by
MAF.cpp
- Committer:
- joe4465
- Date:
- 2014-05-16
- Revision:
- 2:21b70641f866
- Parent:
- 1:fbc57eb4e61d
File content as of revision 2:21b70641f866:
#include "MAF.h" MAF::MAF() {} float MAF::update(float data) { _k[0] = data; _result = _k[0]*0.1 + _k[1]*0.1 + _k[2]*0.1 + _k[3]*0.1 + _k[4]*0.1 + _k[5]*0.1 + _k[6]*0.1 + _k[7]*0.1 + _k[8]*0.1 + _k[9]*0.1 ; _k[9] = _k[8]; _k[8] = _k[7]; _k[7] = _k[6]; _k[6] = _k[5]; _k[5] = _k[4]; _k[4] = _k[3]; _k[3] = _k[2]; _k[2] = _k[1]; _k[1] = _k[0]; return _result; }