AnsweredAssumed Answered

FilterTableGen Coefficient Calculation?

Question asked by lasersocks on Mar 9, 2017
Latest reply on Mar 9, 2017 by KJBob

I am attempting to create my own filter coefficient generator in c and ran into an issue. I am using the formulas from the help  documentation, which I have also confirmed elsewhere on the internet.

 

An example is the bandpass filter with equations shown here:bandpass formula

The result of the FilterTableGen, which also matches up what ends up in the compiled ram is shown here:

filtergen result

 

When you actually follow the formulas the A coefficients are the opposite sign of what they show in FilterTableGen and the RAM. a1 is shown as 1.99298 when the calculation gives -1.99298.

 

w0 = 2*pi*(f/Fs) which at 150 Hz and 96000 Hz sample rate, so w0 = 0.00981. and -2*cos(w0) then comes out to --1.99990, not 1.99298. Which happens to different in value and sign...  This is the same for a2.

 

When you use back calculate the f0/Fs ratio from the values shown in this table using -2*cos(w0) you end up with a ratio of 0.013333 rather than 150/96000 which equals .001563. This is off by a factor of 10.

 

Is there something that I am missing about these coefficients? Is there a factor that I am missing? Am I calculating w0 incorrectly?

 

Thanks!

Outcomes