ΣSigmaStudio Ask AI Русский Log in

IIR filter coefficients for 50Hz notch

SigmaDSP & SigmaStudio wlodek May 12, 2022 00:00 3 replies Original on forum ↗
Subscribe
wlodek Question
May 12, 2022 00:00

Hello,

I am using ADA1761 codec with 48kHz sampling rate. My SigmaStudio project contains the second order double precission IIR filter for which I deliver 'a' and 'b' coefficients calculated in Matlab using iirnotch(w0/(Sfrq/2) , BW/(Sfrq/2) ) where BW = 1.9Hz, w0=50Hz, Sfrq=48kHz.
Matlab coefficients are: b0 = 0.999875660752326, b1=-1.999708490159189, b2=0.999875660752326
a1= -1.999708490159189, a2=0.999751321504651

Using these coefficients in Matlab produces the correct stimulated response (left). When I import these coefficient in SigmaStudio this gives me strange stimulated response (right).

When I import a and b from the text file, SigmaStudio rounds these coefficients to displayed in General Filter Settings edit controls.

Can somebody help me to understand what is wrong?

Wlodek

pastedimage1652365476320v2.png
pastedimage1652365476320v2.png
pastedimage1652365136440v1.png
pastedimage1652365136440v1.png
KJBob Reply
May 12, 2022 00:00

Hello,

I got the same results with the Stimulus-Probe graph, yet running the filter on a ADAU1761Z board gave much better results, as shown below:

So, though the graph shows only a -5 dB notch, the filter really provides a -34 dB notch. This is from limitations of the Stimulus-Probe tool itself:

It doesn't run a bit-accurate simulation of the DSP core -- instead, it performs complex math on the expected response of the coefficients.

Its x-axis frequency points are rather coarse -- so for example, if one of the points doesn't fall exactly on 50 Hz, it won't show the true maximum attenuation of your filter. This tends to happen with any high-Q filter.

Rest assured that your filter will perform quite well in practice.

Best regards,

Bob

Notch-sch.png
Notch-sch.png
wlodek Reply
May 13, 2022 00:00

Thanks for a speedy response!

I will perform some tests with real signal and let you konow.

wlodek Reply
May 13, 2022 00:00

Hello,

I have performed some tests with signal generator (50Hz) connected to my ADAU1761. Indeed IIR notch filter performed much better than Stimulus-Probe graph showed. I got approx. -33 dB on the output.

Thanks again for your help - I will sleep better today.