Created
December 20, 2021 20:16
-
-
Save 0xPIT/2f58cfc2e3ef01ac75fd79b29e6ac6d1 to your computer and use it in GitHub Desktop.
Exponential Moving Average Filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
T exponentialAverageFilter(const T& value, T& pastValue, const float& filterWeight = 0.8) { | |
return static_cast<T>((1.0 - filterWeight) * pastValue + (filterWeight * value)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment