DSPRelated.com
Forums

a question about IIR filter

Started by qittykat2001 October 8, 2007
Hi,All

I've generated a high pass elliptic filter (order =8) using Matlab and
implemented into four stage cascade biquard filter in C55. The passband of
IIR is 300Hz,  stopband is 250Hz, and its attenuation is 60dB. The filter
works fine at the stopband, however it will generate a hum at 288Hz, which
greatly hurt the output SNR, does anyone has a idea about what might cause
the hum? 


BTW, I've checked the filter coefficients after truncation (16bits in C55)
still have all poles inside the unit circle, which is saying the filter is
stable. 

Thanks a lot!




On 8 Okt, 11:36, "qittykat2001" <ysch...@hotmail.com> wrote:
> Hi,All > > I've generated a high pass elliptic filter (order =8) using Matlab and > implemented into four stage cascade biquard filter in C55. The passband of > IIR is 300Hz, stopband is 250Hz, and its attenuation is 60dB. The filter > works fine at the stopband, however it will generate a hum at 288Hz, which > greatly hurt the output SNR, does anyone has a idea about what might cause > the hum? > > BTW, I've checked the filter coefficients after truncation (16bits in C55) > still have all poles inside the unit circle, which is saying the filter is > stable.
So this hum occurs in the middle of the transition band? Does the hum appear with other types of filters (Butterworth, Chebychev)? Did you plot the frequency response of the filter (truncated coefficients)? Rune
qittykat2001 wrote:
> Hi,All > > I've generated a high pass elliptic filter (order =8) using Matlab and > implemented into four stage cascade biquard filter in C55. The passband of > IIR is 300Hz, stopband is 250Hz, and its attenuation is 60dB. The filter > works fine at the stopband, however it will generate a hum at 288Hz, which > greatly hurt the output SNR, does anyone has a idea about what might cause > the hum? > > > BTW, I've checked the filter coefficients after truncation (16bits in C55) > still have all poles inside the unit circle, which is saying the filter is > stable. > > Thanks a lot!
There's probably a limit cycle. Have you implemented fraction saving? Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
"qittykat2001" <yschen3@hotmail.com> wrote in message
news:O5adnbygrLC7Z5TanZ2dnUVZ_uWlnZ2d@giganews.com...
> Hi,All > > I've generated a high pass elliptic filter (order =8) using Matlab and > implemented into four stage cascade biquard filter in C55. The passband of > IIR is 300Hz, stopband is 250Hz, and its attenuation is 60dB. The filter > works fine at the stopband, however it will generate a hum at 288Hz, which > greatly hurt the output SNR, does anyone has a idea about what might cause > the hum?
This very well could be the numeric precision issue. 8th elliptic should have the pretty high Q poles. BTW what is the sample rate?
> BTW, I've checked the filter coefficients after truncation (16bits in C55) > still have all poles inside the unit circle, which is saying the filter is > stable.
Even if the poles are stable, the IIR filters are prone to the limit cycle behaviour and the quantization effects. Try the 32bit implementation and/or filter sections with noise shaping. Vladimir Vassilevsky DSP and Mixed Signal Consultant www.abvolt.com
> >"qittykat2001" <yschen3@hotmail.com> wrote in message >news:O5adnbygrLC7Z5TanZ2dnUVZ_uWlnZ2d@giganews.com... >> Hi,All >> >> I've generated a high pass elliptic filter (order =8) using Matlab and >> implemented into four stage cascade biquard filter in C55. The passband
of
>> IIR is 300Hz, stopband is 250Hz, and its attenuation is 60dB. The
filter
>> works fine at the stopband, however it will generate a hum at 288Hz,
which
>> greatly hurt the output SNR, does anyone has a idea about what might
cause
>> the hum? > >This very well could be the numeric precision issue. 8th elliptic should >have the pretty high Q poles. >BTW what is the sample rate? >
>> BTW, I've checked the filter coefficients after truncation (16bits in
C55)
>> still have all poles inside the unit circle, which is saying the filter
is
>> stable. > >Even if the poles are stable, the IIR filters are prone to the limit
cycle
>behaviour and the quantization effects. Try the 32bit implementation
and/or
>filter sections with noise shaping. > >Vladimir Vassilevsky >DSP and Mixed Signal Consultant >www.abvolt.com > > >
Thanks, the sampling rate is 8K. In C55, when I do the MAC(sample multiple the IIR coefficient), it is 16bit*16bit, and output 32 bits is truncated into 16 bits again. That 's all I can do with TI C55, I am not sure how do implement 32 bit there , do you have any suggestion? Thanks again.
>qittykat2001 wrote: >> Hi,All >> >> I've generated a high pass elliptic filter (order =8) using Matlab and >> implemented into four stage cascade biquard filter in C55. The passband
of
>> IIR is 300Hz, stopband is 250Hz, and its attenuation is 60dB. The
filter
>> works fine at the stopband, however it will generate a hum at 288Hz,
which
>> greatly hurt the output SNR, does anyone has a idea about what might
cause
>> the hum? >> >> >> BTW, I've checked the filter coefficients after truncation (16bits in
C55)
>> still have all poles inside the unit circle, which is saying the filter
is
>> stable. >> >> Thanks a lot! > >There's probably a limit cycle. Have you implemented fraction saving? > >Jerry >-- >Engineering is the art of making what you want from things you can get.
Thanks Jerry, could you pls explain the fraction saving a little bit? Sorry I am really a newbie in DSP area. Thanks again!
>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr; >
>On 8 Okt, 11:36, "qittykat2001" <ysch...@hotmail.com> wrote: >> Hi,All >> >> I've generated a high pass elliptic filter (order =8) using Matlab and >> implemented into four stage cascade biquard filter in C55. The passband
of
>> IIR is 300Hz, stopband is 250Hz, and its attenuation is 60dB. The
filter
>> works fine at the stopband, however it will generate a hum at 288Hz,
which
>> greatly hurt the output SNR, does anyone has a idea about what might
cause
>> the hum? >> >> BTW, I've checked the filter coefficients after truncation (16bits in
C55)
>> still have all poles inside the unit circle, which is saying the filter
is
>> stable. >
>So this hum occurs in the middle of the transition band? >Does the hum appear with other types of filters (Butterworth, >Chebychev)? Did you plot the frequency response of the >filter (truncated coefficients)? > >Rune > >
Thanks Rune, you are right, the hum sits at the transition band forever. I've plot the freqency response of the trancated filter , it looks fine. And I didn't try other IIR filters, but I do try one FIR filter which has the same spec as current elliptic filters, and I didn't see that hum (288Hz) at the output, which increasd my output SNR about 5dB.
On Mon, 08 Oct 2007 08:35:24 -0500, qittykat2001 wrote:

>> >>"qittykat2001" <yschen3@hotmail.com> wrote in message >>news:O5adnbygrLC7Z5TanZ2dnUVZ_uWlnZ2d@giganews.com... >>> Hi,All >>> >>> I've generated a high pass elliptic filter (order =8) using Matlab and >>> implemented into four stage cascade biquard filter in C55. The passband > > of >>> IIR is 300Hz, stopband is 250Hz, and its attenuation is 60dB. The > > filter >>> works fine at the stopband, however it will generate a hum at 288Hz, > > which >>> greatly hurt the output SNR, does anyone has a idea about what might > > cause >>> the hum? >> >>This very well could be the numeric precision issue. 8th elliptic should >>have the pretty high Q poles. >>BTW what is the sample rate? >> > > > > > >>> BTW, I've checked the filter coefficients after truncation (16bits in > > C55) >>> still have all poles inside the unit circle, which is saying the filter > > is >>> stable. >> >>Even if the poles are stable, the IIR filters are prone to the limit > > cycle >>behaviour and the quantization effects. Try the 32bit implementation > > and/or >>filter sections with noise shaping. >> >>Vladimir Vassilevsky >>DSP and Mixed Signal Consultant >>www.abvolt.com >> >> >> > > > Thanks, the sampling rate is 8K. In C55, when I do the MAC(sample multiple > > the IIR coefficient), it is 16bit*16bit, and output 32 bits is truncated > > into 16 bits again. That 's all I can do with TI C55, I am not sure how do > > implement 32 bit there , do you have any suggestion? Thanks again.
Unless you're doing something that's _really_ insensitive to quantization noise an IIR filter needs more than 16 bit calculations. The rule of thumb I use is to add up the width of the input data plus enough bits of precision that the coefficients mean something, plus some padding. For a second order filter this works out to B_f = B_i - log_2(1 - abs(d)) + 3, where B_f is the data width, in bits, of the filter, B_i is the data width of the input, d is the complex pole value, and 3 is what I usually use for padding, if I'm not doing the complete analysis. This article, http://www.wescottdesign.com/articles/zTransform/z-transforms.html, probably isn't the best one for figuring out this particular issue, but you may find it helpful. Skip into the last 1/4 or so to find the comments on the required precision. -- Tim Wescott Control systems and communications consulting http://www.wescottdesign.com Need to learn how to apply control theory in your embedded system? "Applied Control Theory for Embedded Systems" by Tim Wescott Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
qittykat2001 wrote:

   ...

> Thanks Jerry, could you pls explain the fraction saving a little bit? > Sorry I am really a newbie in DSP area.
Not a lot of people are familiar with it. When I thought I invented it, I called it "remainder saving". It turns out that R.B-J. invented it before me, and I use his name for the technique. A more descriptive name is "truncated-part accumulation". When you truncate your 32-bit number, that's the same as making it more negative whenever the truncated part isn't zero. Rounding toward zero removes most of the bias, but there's an even better way if you can spare the execution cycles. (To round toward zero, add 0.5 before truncating.) Accumulate the truncated bits of every product that is to be truncated. Appropriately adjust the truncated product every time the accumulator overflows in either direction. That way, the truncated bits all affect the product. It is as if 32-bit precision had been maintained throughout and the truncation performed only in the final result. Not every product may need this refinement; some are more sensitive than others. There are some programming efficiencies that can speed the procedure. For example, the instruction "add immediate zero with carry" is useful when the fraction accumulator overflows. Since truncation always rounds to -infinity, there are no negative fractions. Google in this group for more discussion and some examples. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
Edited: Jerry Avins wrote:
> qittykat2001 wrote: > > ... > >> Thanks Jerry, could you pls explain the fraction saving a little bit? >> Sorry I am really a newbie in DSP area. > > Not a lot of people are familiar with it. When I thought I invented it, > I called it "remainder saving". It turns out that R.B-J. invented it > before me, and I use his name for the technique. A more descriptive name > would be "truncated-part accumulation". > > When you truncate your 32-bit number, that's the same as making it more > negative whenever the truncated part isn't zero. Rounding toward zero > removes most of the bias and rounding to nearest removes even more, > but there's an even better way if you can spare the execution cycles. > (To round to nearest, add 0.5 before truncating to -infinity.) > > Accumulate the truncated bits of every product that is to be truncated. > Appropriately adjust the truncated product every time the accumulator > overflows in either direction. That way, the truncated bits all affect > the product. It is as if 32-bit precision had been maintained throughout > and the truncation performed only in the final result. > > Not every product may need this refinement; some are more sensitive than > others. There are some programming efficiencies that can speed the > procedure. For example, the instruction "add immediate zero with carry" > is useful when the fraction accumulator overflows. Since truncation > always rounds to -infinity, there are no negative fractions. > > Google in this group for more discussion and some examples. > > Jerry
-- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;