EWMA
EWMA copied to clipboard
Exponentially Weighted Moving Average Filter
Arduino Nano compile does not have Serial.printf and even sprintf() does not have %f FilteredADC:29:12: error: 'class HardwareSerial' has no member named 'printf'; did you mean 'print'? Serial.printf("Raw=%d, Filter1=%.3f, Filter2=%.3f",...
As far as I've understood the doc, all these lines should be equivalent: EwmaT ewmat_sliding_Average(1, 125, 0); => result is ok ! EwmaT ewmat_sliding_Average(4, 500, 0); => result is KO...
The argument of non-using float is false. When you look at the code, there're at least 3 divisions, which are very slow !
Well, the first is true but the second is false. I've tested it, it's way slower than an optimized sliding average with one or more array. On a reasonable amount...