I try to implement an IIR on a 16-bit fixed-point 5510 DSP. After calculating the filter in Matlab, I got the following coefficients:>> iir.tf.numans = 1.0e-005 * 0.0868 0.3470 0.5205 0.3470 0.0868>> iir.tf.denans = 1.0000 -3.8373 5.5250 -3.5375 0.8498 Now I decompose the filter into two biqads:>> tf2sos(iir.tf.num,iir.tf.den)ans = 0.0000 0.0000 0.0000 1.0000 -1.8876 0.8913 1.0000 2.0000 1.0000 1.0000 -1.9497 0.9535 Exellent. Now I want to use DSPLib's iircas5 to implement the filter. The problem is that DSPLib needs coefficients in Q.15, while there are some coefficients that are impossible to fit in Q.15 number. I don't know what should I do, how can I use the calculated filter with the DSPLib procedures? Thanks, Anton Zemlyanov

# IIR on TI 55xx

Started by ●July 23, 2003

Reply by ●July 26, 20032003-07-26

anton@global-ops.com (AntonZ) wrote:>I try to implement an IIR on a 16-bit fixed-point 5510 DSP. After >calculating the filter in Matlab, I got the following coefficients: > >>> iir.tf.num > >ans = > > 1.0e-005 * > > 0.0868 0.3470 0.5205 0.3470 0.0868 > >>> iir.tf.den > >ans = > > 1.0000 -3.8373 5.5250 -3.5375 0.8498 > >Now I decompose the filter into two biqads: > >>> tf2sos(iir.tf.num,iir.tf.den) > >ans = > > 0.0000 0.0000 0.0000 1.0000 -1.8876 0.8913 > 1.0000 2.0000 1.0000 1.0000 -1.9497 0.9535 > >Exellent. Now I want to use DSPLib's iircas5 to implement the filter. >The problem is that DSPLib needs coefficients in Q.15, while there are >some coefficients that are impossible to fit in Q.15 number. I don't >know what should I do, how can I use the calculated filter with the >DSPLib procedures?Divide them by the power of two that makes them all less than one in absolute magnitude. Multiply the resulting numbers by 32768. Round to the nearest integer. That's your coefficients. Take the pre-divide out after the filter multiplication and additions, using shifts. Robert www.gldsp.com ( modify address for return email ) www.numbersusa.com www.americanpatrol.com

Reply by ●July 28, 20032003-07-28

Thanks a lot Robert! r_obert@REMOVE_THIS.hotmail.com wrote in message news:<7lu2iv8sfe3fb9t0dv9dr0resudjkue6sn@4ax.com>...> Divide them by the power of two that makes them all less than one in > absolute magnitude. Multiply the resulting numbers by 32768. Round > to the nearest integer. That's your coefficients. Take the > pre-divide out after the filter multiplication and additions, using > shifts. > > Robert > > www.gldsp.com > > ( modify address for return email ) > > www.numbersusa.com > www.americanpatrol.com

Reply by ●February 18, 20102010-02-18

Dear all, I have exactly the same problem as Anton, but I'm not clear how the suggested solution will work correctly (no disrespect intended to Robert). For a single stage biquad (for simplicity), we have: w(n) = x(n) - a1*w(n-1) - a2*w(n-2) y(n) = b0*w(n) + b1*w(n-1) + b2*w(n-2) In Anton's example (for his second stage), the coefficients are: a0 = 1 a1 = -1.9497 a2 = 0.9535 b0 = 1 b1 = 2 b2 = 1 (Matlab outputs the coefficients in the order b0, b1, b2, a0, a1, a2) I see immediately how one can scale the 'b' coefficients at will, and rescale the output, because each 'b' coefficient acts on w(n), w(n-1) and w(n-2) to yield y(n). However, the iircas5 function only accepts a1 and a2 (a0 is implicitly equal to 1). Therefore, dividing the 'a' coefficients by a factor of 2 (in this case) will alter the filter characteristics. The coefficients would then be: a0 = 1 (implicit) a1 = -0.9748 a2 = 0.4767 As the 'a' coefficients are applied recursively, dividing a1 and a2 by a factor of 2 would essentially be dividing the three terms in my first equation by 1, 2 and 4. Hopefully I have explained that reasonably clearly, and having banged my head against this particular problem for a day or two, someone can point out the error in my logic, or explain how one uses iircas5 under these circumstances! Many thanks in advance, John Sumner>Thanks a lot Robert! > >r_obert@REMOVE_THIS.hotmail.com wrote in messagenews:<7lu2iv8sfe3fb9t0dv9dr0resudjkue6sn@4ax.com>...>> Divide them by the power of two that makes them all less than one in >> absolute magnitude. Multiply the resulting numbers by 32768. Round >> to the nearest integer. That's your coefficients. Take the >> pre-divide out after the filter multiplication and additions, using >> shifts. >> >> Robert >> >> www.gldsp.com >> >> ( modify address for return email ) >> >> www.numbersusa.com >> www.americanpatrol.com >