2
$\begingroup$

I am having an all pole IIR filter of order 5 with floating point filter coefficients

[1,
-4.708642687,   
9.963818327 ,
-11.99038368,   
8.647611478,    
-3.553230696,   
0.659454607].

When an impulse input was applied to the IIR filter, the first 8 output samples obtained were

1,
4.7086,
12.20,
22.5509,
32.38,
36.9400,
32.26087.

To implement the same system in hardware, I have scaled the filter coefficients by a factor of $2^{10}$ and down-scaled back at the output. Similarly all the operations were done in fixed-point representation. However, the first 8 output samples obtained at the output were

1,
5,
14,
29,
49,
70,
86,
91,
82 etc.

How to reduce this large difference in the output when trying to convert from floating point to fixed point

$\endgroup$
4
  • 1
    $\begingroup$ Could you show us the code? Also, did you compute the output using fixed-point or floating point operations, i.e., did you only quantize the coefficients or did you perform all computations using fixed-point? $\endgroup$
    – Matt L.
    Jun 18 '20 at 7:58
  • $\begingroup$ The equation of an all pole IIR filter which is y(n)=x(n)- Σay(n-k).Here filter coefficients a are scaled by 2^10.After that the filter coefficients are multiplied by previous output samples y(n-k).After the summation,I am dividing by 2^10.The entire system model is implemented as 16 bit two's complement form. $\endgroup$
    – Deepa
    Jun 20 '20 at 4:35
  • $\begingroup$ What are your coefficients in HW implementation? $\endgroup$
    – Juha P
    Jun 20 '20 at 8:50
  • $\begingroup$ The feedback coefficients a_k are obtained by scaling the floating point coefficients with 2^10 and then truncating the fractional part.So the value of a used are: [1024 -4821 10202 -12278 8855 -3638 675] $\endgroup$
    – Deepa
    Jun 22 '20 at 10:20
2
$\begingroup$

Where are the poles of your filter? If they are close to the unit circle, then quantizing them can cause some of them to cross beyond the unit circle, causing the quantized filter to be unstable. You should check the poles of your filter before quantizing and after quantizing. See how close they match.

Secondly, it's risky, albeit not impossible, to implement an order-5 IIR filter directly in fixed-point arithmetic. Usually, it's a good idead to split it in cascaded order-2 filters, each of these order-2 IIR filters is usually called a "biquad". In your case you would have 2 cascaded biquads with one order-1 IIR filter.

There are many references that you can check out such as this one.

https://www.dsprelated.com/showarticle/1137.php

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.