DSPRelated.com
Forums

about IIR Filter implementation...

Started by zeugnim September 6, 2007
hi,

This is my first filter implementation and is made in Scilab, also the
design of the 3ord Chebyshev Type I IIR Filter (with the iir function). I
actually have 3 filters, so i can use them as an equalizer for an audio
application. I´m using Direct Form I Realization. Since I have to
implement this on a 24bit Fixed-Point DSP I had to scale my coefficients
by a factor of 256 (same as shifting 8 bits). The problem that I've been
having is that the output signal generated by the scilab script gets some
attenuation but only with my coefficients scaled, without the scale factor
I get 0 dB gain. I don't know what am I doing wrong. The script is based on
a Fixed Point Implementation of DFI IIR Filter shown in "Real-Time Digital
Signal Processing - Implementations and Applications", basically it first
update the input buffer, insert new data on the first position of that
bufffer, then it multiply and accumulate b coefs(numerator) with inputs,
then makes the same thing with a coefs(denominator) and an output buffer
and finally it subtract both variables used as accumulators and place the
result into the first position of the output buffer.

I really apreciate anyone's help cause I'm stuck here and I want to learn
all I can about DSP, also it would be nice if anyone know about some
reading that I can use. Anyways... thanks for your attention...

Regards,
Daniel


On Thu, 06 Sep 2007 12:43:09 -0500, zeugnim wrote:

> hi, > > This is my first filter implementation and is made in Scilab, also the > design of the 3ord Chebyshev Type I IIR Filter (with the iir function). I > actually have 3 filters, so i can use them as an equalizer for an audio > application. I´m using Direct Form I Realization. Since I have to > implement this on a 24bit Fixed-Point DSP I had to scale my coefficients > by a factor of 256 (same as shifting 8 bits). The problem that I've been > having is that the output signal generated by the scilab script gets some > attenuation but only with my coefficients scaled, without the scale factor > I get 0 dB gain. I don't know what am I doing wrong. The script is based on > a Fixed Point Implementation of DFI IIR Filter shown in "Real-Time Digital > Signal Processing - Implementations and Applications", basically it first > update the input buffer, insert new data on the first position of that > bufffer, then it multiply and accumulate b coefs(numerator) with inputs, > then makes the same thing with a coefs(denominator) and an output buffer > and finally it subtract both variables used as accumulators and place the > result into the first position of the output buffer. > I really apreciate anyone's help cause I'm stuck here and I want to learn > all I can about DSP, also it would be nice if anyone know about some > reading that I can use. Anyways... thanks for your attention... >
Are you rounding the coefficients? Are you filtering at low frequencies compared to the sample rate? Are you using third-order filters instead of a 1st-order cascaded with a 2nd order? Any of these things could cause your DC gain (and other filter behavior) to be off. -- 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
>On Thu, 06 Sep 2007 12:43:09 -0500, zeugnim wrote: > >> hi, >> >> This is my first filter implementation and is made in Scilab, also the >> design of the 3ord Chebyshev Type I IIR Filter (with the iir function).
I
>> actually have 3 filters, so i can use them as an equalizer for an
audio
>> application. I´m using Direct Form I Realization. Since I have to >> implement this on a 24bit Fixed-Point DSP I had to scale my
coefficients
>> by a factor of 256 (same as shifting 8 bits). The problem that I've
been
>> having is that the output signal generated by the scilab script gets
some
>> attenuation but only with my coefficients scaled, without the scale
factor
>> I get 0 dB gain. I don't know what am I doing wrong. The script is
based on
>> a Fixed Point Implementation of DFI IIR Filter shown in "Real-Time
Digital
>> Signal Processing - Implementations and Applications", basically it
first
>> update the input buffer, insert new data on the first position of that >> bufffer, then it multiply and accumulate b coefs(numerator) with
inputs,
>> then makes the same thing with a coefs(denominator) and an output
buffer
>> and finally it subtract both variables used as accumulators and place
the
>> result into the first position of the output buffer. >> I really apreciate anyone's help cause I'm stuck here and I want to
learn
>> all I can about DSP, also it would be nice if anyone know about some >> reading that I can use. Anyways... thanks for your attention... >> >Are you rounding the coefficients? Are you filtering at low frequencies
>compared to the sample rate? Are you using third-order filters instead >of a 1st-order cascaded with a 2nd order? > >Any of these things could cause your DC gain (and other filter >behavior) to be off. > >-- >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 >
Yes, my sample rate is twice faster than the higher frequency that I'm filtering... but about rounding the coefficients I guess I'm not, so I do a little research on doing that, thanks. And yes I'm using third-order bandpassing filters, do you suggest me to use SOS??