<div dir="ltr"><div>One way you could observe the frequency response of the filter is to generate sine wave samples and feed them into the filter. Sweep the sine wave at say 1Hz per ms. Observe the output by feeding the results into a file or into a d->a convertor. If you wish to observe the results on an oscilloscope the time from the beginning of the sweep to 3dB attenuation gives you the cutoff frequency. Adjust the filter parameters if the response is not as you desire.</div><div>Hope that helps or am I missing something?<br></div><div><br></div><div>Richard Jones<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 25, 2024 at 4:51 PM Robin Gilks <<a href="mailto:gb7ipd@gmail.com">gb7ipd@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>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:</div><div>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 <span><span style="color:inherit"></span><span id="m_-7436177329987016590gmail-MathJax-Element-70-Frame" role="presentation"><span aria-hidden="true"><span id="m_-7436177329987016590gmail-MathJax-Span-734" style="width:15.139em;display:inline-block"><span style="display:inline-block;width:12.404em;height:0px;font-size:122%"><span><span id="m_-7436177329987016590gmail-MathJax-Span-735"><span id="m_-7436177329987016590gmail-MathJax-Span-736" style="font-family:MathJax_Math;font-style:italic"></span></span></span>.......wah wah wah wah</span></span></span></span></span></div><div>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.<span><span id="m_-7436177329987016590gmail-MathJax-Element-70-Frame" role="presentation"><span aria-hidden="true"><span id="m_-7436177329987016590gmail-MathJax-Span-734" style="width:15.139em;display:inline-block"><span style="display:inline-block;width:12.404em;height:0px;font-size:122%"><br></span></span></span></span></span></div><div><span><span id="m_-7436177329987016590gmail-MathJax-Element-70-Frame" role="presentation"><span aria-hidden="true"><span id="m_-7436177329987016590gmail-MathJax-Span-734" style="width:15.139em;display:inline-block"><span style="display:inline-block;width:12.404em;height:0px;font-size:122%"><br></span></span></span></span></span></div><div>I think what I'm looking for is </div><div>Fcutoff =-ln(alpha) * Fsample / (2 * pi)</div><div><br></div><div>but I can't find any confirmation of that amongst all the smartarse answers on StackExchange etc</div><div><br></div><div>Looks like I'll just have to carry on guessing</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 25, 2024 at 9:29 AM Charles Manning <<a href="mailto:cdhmanning@gmail.com" target="_blank">cdhmanning@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Here's a relatively simple article on first order IIRs<br>
<br>
<a href="https://dsp.stackexchange.com/questions/34969/cutoff-frequency-of-a-first-order-recursive-filter" rel="noreferrer" target="_blank">https://dsp.stackexchange.com/questions/34969/cutoff-frequency-of-a-first-order-recursive-filter</a><br>
<br>
On Wed, Jan 24, 2024 at 11:47 PM Robin Gilks <<a href="mailto:gb7ipd@gmail.com" target="_blank">gb7ipd@gmail.com</a>> wrote:<br>
><br>
> 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.<br>
> BTW: I'm using a micro with hardware floating point !<br>
><br>
> On Wed, Jan 24, 2024 at 8:17 PM Charles Manning <<a href="mailto:cdhmanning@gmail.com" target="_blank">cdhmanning@gmail.com</a>> wrote:<br>
>><br>
>> Have a play around on <a href="https://fiiir.com/" rel="noreferrer" target="_blank">https://fiiir.com/</a>. This has sections for both<br>
>> FIR and IIR.<br>
>><br>
>> These are the simplest filters you can build, but I would recommend<br>
>> using fixed point if you are running it on a low power micro. You can<br>
>> avoid multiplies by doing things like<br>
>><br>
>> out = out + (in - out)/4; // (which will turn into +, - and a shift).<br>
>><br>
>><br>
>><br>
>><br>
>> On Wed, Jan 24, 2024 at 4:59 PM Robin Gilks <<a href="mailto:gb7ipd@gmail.com" target="_blank">gb7ipd@gmail.com</a>> wrote:<br>
>> ><br>
>> > Greetings all<br>
>> ><br>
>> > I'm after the simplest answer to the question: what is the cutoff frequency of an Exponential Moving Average Infinite Impulse Response filter.<br>
>> > 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 😀<br>
>> ><br>
>> ><br>
>> > #define ALPHA 0.3<br>
>> > static float EMA_S; // Exponential Moving Average - Signal<br>
>> ><br>
>> > EMA_S = (ALPHA*sample) + ((1-ALPHA)*EMA_S);<br>
>> ><br>
>> ><br>
>> > Cheers<br>
>> > --<br>
>> > Robin Gilks<br>
>> ><br>
>> > _______________________________________________<br>
>> > Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.ourshack.com" target="_blank">Chchrobotics@lists.ourshack.com</a><br>
>> > <a href="https://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">https://lists.ourshack.com/mailman/listinfo/chchrobotics</a><br>
>> > Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/pipermail/chchrobotics/</a><br>
>> > Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
>> > When replying, please edit your Subject line to reflect new subjects.<br>
>><br>
>> _______________________________________________<br>
>> Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.ourshack.com" target="_blank">Chchrobotics@lists.ourshack.com</a><br>
>> <a href="https://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">https://lists.ourshack.com/mailman/listinfo/chchrobotics</a><br>
>> Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/pipermail/chchrobotics/</a><br>
>> Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
>> When replying, please edit your Subject line to reflect new subjects.<br>
><br>
> _______________________________________________<br>
> Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.ourshack.com" target="_blank">Chchrobotics@lists.ourshack.com</a><br>
> <a href="https://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">https://lists.ourshack.com/mailman/listinfo/chchrobotics</a><br>
> Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/pipermail/chchrobotics/</a><br>
> Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
> When replying, please edit your Subject line to reflect new subjects.<br>
<br>
_______________________________________________<br>
Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.ourshack.com" target="_blank">Chchrobotics@lists.ourshack.com</a><br>
<a href="https://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">https://lists.ourshack.com/mailman/listinfo/chchrobotics</a><br>
Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/pipermail/chchrobotics/</a><br>
Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
When replying, please edit your Subject line to reflect new subjects.</blockquote></div>
_______________________________________________<br>
Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.ourshack.com" target="_blank">Chchrobotics@lists.ourshack.com</a><br>
<a href="https://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">https://lists.ourshack.com/mailman/listinfo/chchrobotics</a><br>
Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/pipermail/chchrobotics/</a><br>
Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
When replying, please edit your Subject line to reflect new subjects.</blockquote></div>