[chbot] EMA IIR cutoff calculation

Robin Gilks gb7ipd at gmail.com
Wed Jan 24 03:57:37 GMT 2024


Greetings all

I'm after the simplest answer to the question: what is the cutoff frequency
of an Exponential Moving Average Infinite Impulse Response filter.
This code snippet is called at 8KHz with a sample from the ADC. I know
there is a natural log of ALPHA somewhere in the equation but trying to
find the simple solution on the 'net buries me in Bode plots and sumof
equations. I specifically don't want a mathematical treatise on EMAs, just
a simple formula I can plug into my code 😀


#define ALPHA     0.3
static float EMA_S;                     // Exponential Moving Average -
Signal

   EMA_S = (ALPHA*sample) + ((1-ALPHA)*EMA_S);


Cheers
-- 
Robin Gilks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20240124/7a8f09cf/attachment.html>


More information about the Chchrobotics mailing list