# different from the helping document

Question asked by leiming on Feb 25, 2011
Latest reply on May 6, 2011 by BrettG

Hi! I find a serious proble that the value of coefficient which generate from the SigmaStudio is different from the equation of helping document!

For example,a 1st order filter,We set for 1000HZ frequency,gain of 0dB and as the lowpass filter,I got the coefficient are respectively 0.121918916702271  ,0,  0.878081083297729

In helping a document

The General 1st-Order block has two algorithms options.

Common variables:

ω0 = 2*pi*f0/Fs

gainLinear = 10^(gain/20)

Lowpass

 Transfer Function Coefficients a1 = 2.7^-ω0b0 = gainLinear * (1.0 - a1)b1 = 0

f0=1000Hz;Fs=48000Hz;gain=0;

So w0=2*pi*1000/48000=0.130899693899574718269276;gainlinear=10^(0/20)=1;

a1=2.7^-w0=2.7^-0.130899693899574718269276=1.1388470067969598079945487283746;

a1=1/a1=0.87808107149750427306800276251186;

b0= gainLinear * (1.0 - 1/a1)=0.1219189285024957269319972374;     b1=0;

In the actual implementation on the DSP, when the coefficients are stored in parameter RAM, a1 needs to be inverted. This is done in software, automatically, before the parameters are written to memory.

For example,a general 2nd order filter,we set for 1000Hz frequency, gain of 0dB,Q of 1.41, and as the lowpass filter,i got the coefficient are respectively EQ1940Single10B1=0.00408828258514404;

EQ1940Single11B1=0.00817668437957764;

EQ1940Single12B1=0.00408828258514404;

EQ1940Single11A1=1.8951700925827;

EQ1940Single12A1=-0.911523461341858;

But in helping a docment:

Lowpass

ω0 = 2*pi*f0/Fs

gainLinear = 10^(gain/20)

 Transfer Function Coefficients alpha = sin(ω0)/(2*Q) a0 =   1 + alphaa1 =  -2*cos(ω0)a2 =   1 - alphab0 =  (1 - cos(ω0)) * gainLinear / 2b1 =   1 - cos(ω0)  * gainLinearb2 =  (1 - cos(ω0)) * gainLinear / 2

For all of the above filters, the coefficients are divided by a0, normalizing them and making a0 = 1 so that only 5 coefficients must be stored. In the actual implementation on the DSP, when the coefficients are stored in parameter RAM, a1 and a2 need to be inverted. This is done automatically, in software, before the parameters are written to memory.

Among them
gain=0dB;fs=1000Hz;Fs=48000Hz; Q=1.41;

So w0=2*pi*1000/48000=0.130899693899574718269276; gainlinear=1;

alpha=sin(0.130899693899574718269276)/(2*1.41)=0.0008101520074285072310965239913;

a0=1+0.0008101520074285072310965239913=1.0008101520074285072310965239913;

a1=-2*cos(0.130899693899574718269276)=-1.9999947804650706869450798840089; 1/a1=-0.50000130488713778026095773346491;

a2=1-0.0008101520074285072310965239913=0.999189847992571492768903476009;1/a2=1.0008108088858750397659847761385;

b0=(1-cos(0.130899693899574718269276))/2=--0.0000013048837323282637300289978;

b1=2*b0=-0.000002609767464656527460057994;b2=b0;

Easily we could find the difference between the coefficient values generated by SigmaStudio, and those you calculate accoeding to the equation of helping document.