**Category:**Software

**Product Number:**adau1467

**Software Version:**sigmastudio 4.7

I calculate IIR Coefficient through mcu and the filter generated by General HP/LP/BP/BS is inconsistent

My IIR Coefficient formula, refer to the forum https://ez.analog.com/dsp/sigmadsp/f/q-a/65799/eq-low--and-high-shelf-filter-coefficients-comming-back---mysterious-s-factor

excel Calculation results：

my muc Calculation results:

now sigmaStudio 4.7

I found that the data A1 and A2 generated by this sigmaStudio 4.7 are inconsistent with the negative values I generated.

Safeload Write

Time: 01:34:34 - 841ms

IC: IC 1

Cell Name: X_OVER_01.HP1_5

Param Name: EQGenFilterDPS300Alg161A2_1

Param Address: 0x0000

Param Value: -0.877223670482636

Bytes: 4

Param Data:

0xFF, 0x1F, 0x6E, 0x45

Safeload Write

Time: 01:34:34 - 842ms

IC: IC 1

Cell Name: X_OVER_01.HP1_5

Param Name: EQGenFilterDPS300Alg161A1_1

Param Address: 0x0000

Param Value: 1.87320441007614

Bytes: 4

Param Data:

0x01, 0xDF, 0x8A, 0x53

This problem has been bothering me for several days, looking for help from the official website

#include <stdio.h> #include <math.h> #define PI 3.14159265358979323846f #define fc 1000 #define fs 96000 int main() { float omega = PI * fc / fs; float sn = sinf(omega); float cs = cosf(omega); float Q = 0.5f; float gainDB = 0.0f; float alpha = sn / (2 * Q); float a0 = alpha + 1; float linearGain = powf(10, gainDB / 20); float b0 = ((1 + cs) * linearGain) / (2 * a0); float b1 = -((1 + cs) * linearGain) / a0; float b2 = b0; float a1 = -(2 / a0) * cs; float a2 = (1 - alpha) / a0; printf("fc:%d\n",fc); printf("fs:%d\n",fs); printf("omega:%lf\n",omega); printf("alpha:%lf\n",alpha); printf("A0:%lf\n",a0); printf("linearGain:%lf\n",linearGain); printf("------------------------\n"); printf("B0:%lf\n",b0); printf("B1:%lf\n",b1); printf("B2:%lf\n",b2); printf("A1:%lf\n",a1); printf("A2:%lf\n",a2); return 0; }

float omega = 2 * PI * fc / fs now modify float omega =PI * fc / fs c code bug： float a1 = -(2 / a0) * cs; float a2 = (1 - alpha) / a0; The negative values of the two variables a1 and a2 are wrong

[

**edited by:**weixiao at 10:32 AM (GMT -4) on 7 Aug 2022]