When using a Digital Filter Design Package, such as
MatLab®, to generate an IIR biquad coefficients follow these steps:
- Compute the coefficients [b0, b1, b2, a0, a1, a2] with a filter design function, such as the Matlab butter function to design a Butterworth filter with cutoff at 1 kHz of a system running at 48 kHz. Note that Matlab coefficients are normalized with a0 = 1.
[b, a] = butter( 2, 1000 / (48000/2) )
- Convert these coefficients to [N0, N1, N2, D1, D2] by dividing:
- Convert the coefficients to Q31 by multiplying by 231.
- Round to nearest integer and convert to a 32-bit two's complement hexadecimal format:
- For positive integers, convert to hexadecimal format.
- For negative integers, take the absolute value of the coefficient, convert it to binary, negate it, add one, and convert to hex.