[chbot] EMA IIR cutoff calculation

Robin Gilks gb7ipd at gmail.com
Thu Jan 25 03:49:56 GMT 2024


Thats one of the pages I've visited and still none the wiser. I followed a
link to another page and was immediately hit by:
The impulse invariant discrete formulation of the ideal low pass filter is
obtained from the solution to the first order linear differential equation
of the scalar (one dimensional) differential equation corresponding to the
Laplace transform of the filter .......wah wah wah wah
Just the sort of stuff I'm too old and not bothered enough to spend hours
trying to catch up on from when I was at college over 50 years ago.

I think what I'm looking for is
Fcutoff =-ln(alpha) * Fsample / (2 * pi)

but I can't find any confirmation of that amongst all the smartarse answers
on StackExchange etc

Looks like I'll just have to carry on guessing


On Thu, Jan 25, 2024 at 9:29 AM Charles Manning <cdhmanning at gmail.com>
wrote:

> Here's a relatively simple article on first order IIRs
>
>
> https://dsp.stackexchange.com/questions/34969/cutoff-frequency-of-a-first-order-recursive-filter
>
> On Wed, Jan 24, 2024 at 11:47 PM Robin Gilks <gb7ipd at gmail.com> wrote:
> >
> > I'm already using (and have been for years) IIR filters like this but
> I've always used seat-of-the-pants trial and error to determine the ALPHA
> value. I'd like to be a bit more precise.
> > BTW: I'm using a micro with hardware floating point !
> >
> > On Wed, Jan 24, 2024 at 8:17 PM Charles Manning <cdhmanning at gmail.com>
> wrote:
> >>
> >> Have a play around on https://fiiir.com/. This has sections for both
> >> FIR and IIR.
> >>
> >> These are the simplest filters you can build, but I would recommend
> >> using fixed point if you are running it on a low power micro. You can
> >> avoid multiplies by doing things like
> >>
> >> out = out + (in - out)/4;  // (which will turn into +, - and a shift).
> >>
> >>
> >>
> >>
> >> On Wed, Jan 24, 2024 at 4:59 PM Robin Gilks <gb7ipd at gmail.com> wrote:
> >> >
> >> > 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
> >> >
> >> > _______________________________________________
> >> > Chchrobotics mailing list Chchrobotics at lists.ourshack.com
> >> > https://lists.ourshack.com/mailman/listinfo/chchrobotics
> >> > Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> >> > Meetings usually 3rd Monday each month. See http://kiwibots.org for
> venue, directions and dates.
> >> > When replying, please edit your Subject line to reflect new subjects.
> >>
> >> _______________________________________________
> >> Chchrobotics mailing list Chchrobotics at lists.ourshack.com
> >> https://lists.ourshack.com/mailman/listinfo/chchrobotics
> >> Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> >> Meetings usually 3rd Monday each month. See http://kiwibots.org for
> venue, directions and dates.
> >> When replying, please edit your Subject line to reflect new subjects.
> >
> > _______________________________________________
> > Chchrobotics mailing list Chchrobotics at lists.ourshack.com
> > https://lists.ourshack.com/mailman/listinfo/chchrobotics
> > Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> > Meetings usually 3rd Monday each month. See http://kiwibots.org for
> venue, directions and dates.
> > When replying, please edit your Subject line to reflect new subjects.
>
> _______________________________________________
> Chchrobotics mailing list Chchrobotics at lists.ourshack.com
> https://lists.ourshack.com/mailman/listinfo/chchrobotics
> Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> Meetings usually 3rd Monday each month. See http://kiwibots.org for
> venue, directions and dates.
> When replying, please edit your Subject line to reflect new subjects.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20240125/03f6f681/attachment.html>


More information about the Chchrobotics mailing list