DSPRelated.com
Forums

Help with Butterworth Filter

Started by Stewart March 29, 2004
"Butterworth" is used a lot in radio because of very low loss and nice phase
change characteristics, (real HW filter) however Stewart's problem, is
already digitized, so brick wall etc, something else easy to pick up should
work, just cutting out the highs.

"Tim Wescott" <tim@wescottnospamdesign.com> wrote in message
news:106k00ui3k5hj4a@corp.supernews.com...
> Andor wrote: > > Tim Wescott wrote: > > > >>Stewart wrote: > > > > ... > > > >>>a0= 8.663387E-04 > >>>a1= 1.732678E-03 b1= 1.919129E+00 > >>>a2= 8.663387E-04 b2= -9.225943E-01 > >>> > >>>Question is - what is the formula that I plug these five constants > >>>into to give me g(t), ie the lowpass filter output at a point t??? > >> > >>First observation: that doesn't look right. The transfer function > >>should be normalized (see OP) so that the highest-order term in the > >>denominator is one: > >> > >> b_2 z^2 + b_1 z > >>H(z) = ------------------- > >> z^2 + a_1 z + a_0 > > > > > > Signal processing guys prefer the technically realizable form: > > > > H(z) = (a_0 + a_1 z^{-1} + a_2 z^{-2} )/(1 - (b_1 z^{-1} + b_2 > > z^{-2})) > > > > and this looks perfectly allright to me. This system has a frequency > > response of a bilinear transformed lowpass filter with cutoff > > frequency Fc = 0.01 ( = fc / fs). It is realized by this recursion > > equation: > > > > g(t) = a_0 f(t) + a_1 f(t-T) + a_2 f(t-2T) + b_1 g(t-T) + b_2 g(t-2T) > > > > where T is the sampling period. > > > > > >>Second observation: Why in the heck are you messing with IIR filters if > >>you have a DSP? > > > > > > There are many good reasons for IIR filters. If done right they > > perform as expected (btw, the DSP MAC instruction is just as > > applicable to IIR as to FIR filters). > > > > Regards, > > Andor > > Boy I'm getting a lot of grief for that comment -- which I suppose I > should, since I probably implement more IIR filters than FIR ones > myself. And yes, the DSP MAC instruction is just as applicable, but if > you're only multiplying a few things together you spend as many clock > ticks in extra setup for the 1-cycle MAC is you save by having it happen > in one cycle. If _all_ you're doing is one or two IIR filters you may > as well do it on a fast RISC processor as a DSP -- you only see value > from the one-cycle MAC if you can express a bunch of IIR filters as a > matrix multiply or if you're doing FIR filters. > > -- > > Tim Wescott > Wescott Design Services > http://www.wescottdesign.com
In article <3e8a4d01.0403291930.2b02e550@posting.google.com>,
Stewart <windsurfing_stew@yahoo.com.au> wrote:
>Basically I'm looking to numerically produce g(t) which is f(t) with >all frequencies higher than 0.01 (seconds/data point) filtered out. > >Keeping it simple - lets say I want a second order (ie 2 pole) >Butterworth Filter this gives (from a table in a book) > >a0= 8.663387E-04 >a1= 1.732678E-03 b1= 1.919129E+00 >a2= 8.663387E-04 b2= -9.225943E-01 > >Question is - what is the formula that I plug these five constants >into to give me g(t), ie the lowpass filter output at a point t???
I found the following article easy to understand, useful for writing code to test, and as a bonus, included a description of BOTH a 2-pole Butterworth and a 2-pole Critically-Damped filter, both adjusted to have a 3dB cutoff anywhere you specify, accounting for the sampling rate. It contains the formulas for the coefficients, not just tables of constants. http://people.umass.edu/exsci735/Robertson&Dowling.pdf Beware of combinations of cutoff and sampling rate that result in the adjusted angular cutoff frequency to be Wc >= tan(pi/2) which blows up (this is true for both kinds of filters described). It starts ringing at Wc=tan(pi/4), and I've found it best to keep Wc<tan(pi/8). -A