Hello All, I am in the process of creating a front end for a butterworth low pass filter of order 4.This will allow the user to enter the cut off frequency and the software will calculate the co-efficients for the user. I used the information(formula for co-efficients) from this website http://www.apicsllc.com/apics/Sr_3/Sr_3.htm The formula is correct for the band stop filter but it doesn't work correctly for the low pass filter.I have verified my results with winfilter and MATLAB.Can anyone help me with a generic formula for the co-efficients for low pass 4th order filter?? Thanks a bunch Vj
IIR Filter Co-efficients Formula
Started by ●October 16, 2007
Reply by ●October 16, 20072007-10-16
On 16 Okt, 16:56, right05 <vidu...@gmail.com> wrote:> Hello All, > > I am in the process of creating a front end for a butterworth low pass > filter of order 4.This will allow the user to enter the cut off > frequency and the software will calculate the co-efficients for the > user. > I used the information(formula for co-efficients) from this websitehttp://www.apicsllc.com/apics/Sr_3/Sr_3.htm > > The formula is correct for the band stop filter but it doesn't work > correctly for the low pass filter.I have verified my results with > winfilter and MATLAB.Can anyone help me with a generic formula for the > co-efficients for low pass 4th order filter??Well, if the formulaf or the BP filter works, there is no reason why the LP formulas shouldn't work. What's left, then, is the question whether a 4th order LP filter can meet the spec. If you Restrict the order to exactly 4, you have done away with one very imprtant degree of freedom in filter design. Rune
Reply by ●October 16, 20072007-10-16
Thanks Rune.But the filter is part of our front end and that suffice our application.If you look at the website ,http://www.apicsllc.com/ apics/Sr_3/Sr_3.htm the formula for the co-efficients for low pass and high pass looks exactly the same( Just the denominator co-efficients for order 4) LPF (Order 4) n0=1, n1=4, n2=6 n3=4 n4=1 d0= (0.07*C^2 +0.13*C+0.07)*(0.03*C^2+0.002*C+0.03) d1= -0.032*(C^2-1)*(125*C^2+163.168*C+125) d2=6*C^4-6.83*C^2+6 d3=-0.032*(C^2-1)*(125*C^2-163.168*C+125) d4=(0.07*C^2 -0.13*C+0.07)*(0.03*C^2-0.002*C+0.03) HPF (order 4) n0=C^4 n1=4* C^4 n2=6* C^4 n3=4* C^4 n4= C^4 d0= (0.07*C^2 +0.13*C+0.07)*(0.03*C^2+0.002*C+0.03) d1= -0.032*(C^2-1)*(125*C^2+163.168*C+125) d2=6*C^4-6.83*C^2+6 d3=-0.032*(C^2-1)*(125*C^2-163.168*C+125) d4=(0.07*C^2 -0.13*C+0.07)*(0.03*C^2-0.002*C+0.03) I would greatly appreciate if someone can give me a generic formula for fourth order low pass filter. Thanks Vj
Reply by ●October 16, 20072007-10-16
On Tue, 16 Oct 2007 14:56:04 +0000, right05 wrote:> Hello All, > > I am in the process of creating a front end for a butterworth low pass > filter of order 4.This will allow the user to enter the cut off > frequency and the software will calculate the co-efficients for the > user. > I used the information(formula for co-efficients) from this website > http://www.apicsllc.com/apics/Sr_3/Sr_3.htm > > The formula is correct for the band stop filter but it doesn't work > correctly for the low pass filter.I have verified my results with > winfilter and MATLAB.Can anyone help me with a generic formula for the > co-efficients for low pass 4th order filter?? > > Thanks a bunch > VjSomewhere in that discussion the cutoff frequency and the sampling rate get dropped -- also if you look at the "any DSP text" that he references you'll find that pole warping is far more involved (but still doable) than he states. I'd look for a better source. I'm away from my reference shelf right now, but I'll bet that Rick Lyons's book goes into this. Trolling your local university library for "any DSP text" may be good, too, if it doesn't take a day to get there. -- 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
Reply by ●October 16, 20072007-10-16
Tim Wescott wrote:> On Tue, 16 Oct 2007 14:56:04 +0000, right05 wrote: > >> Hello All, >> >> I am in the process of creating a front end for a butterworth low pass >> filter of order 4.This will allow the user to enter the cut off >> frequency and the software will calculate the co-efficients for the >> user. >> I used the information(formula for co-efficients) from this website >> http://www.apicsllc.com/apics/Sr_3/Sr_3.htm >> >> The formula is correct for the band stop filter but it doesn't work >> correctly for the low pass filter.I have verified my results with >> winfilter and MATLAB.Can anyone help me with a generic formula for the >> co-efficients for low pass 4th order filter?? >> >> Thanks a bunch >> Vj > > Somewhere in that discussion the cutoff frequency and the sampling rate > get dropped -- also if you look at the "any DSP text" that he references > you'll find that pole warping is far more involved (but still doable) than > he states. > > I'd look for a better source. I'm away from my reference shelf right now, > but I'll bet that Rick Lyons's book goes into this. Trolling your local > university library for "any DSP text" may be good, too, if it doesn't take > a day to get there. >Rick Lyons, "Understanding Digital Signal Processing", Prentice-Hall, 2004, chapter 6. Or Oppenheim & Schafer, "Digital Signal Processing", Prentice-Hall, 1975. It's definitely a less accessible book than the Lyons book, both in getting your hands on the old thing and in understanding what the heck is being said once you have it -- but it's what was sitting on my shelf... -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by ●October 16, 20072007-10-16
On Oct 16, 12:35 pm, Tim Wescott <t...@seemywebsite.com> wrote:> On Tue, 16 Oct 2007 14:56:04 +0000, right05 wrote: > > Hello All, > > > I am in the process of creating a front end for a butterworth low pass > > filter of order 4.This will allow the user to enter the cut off > > frequency and the software will calculate the co-efficients for the > > user. > > I used the information(formula for co-efficients) from this website > >http://www.apicsllc.com/apics/Sr_3/Sr_3.htm > > > The formula is correct for the band stop filter but it doesn't work > > correctly for the low pass filter.I have verified my results with > > winfilter and MATLAB.Can anyone help me with a generic formula for the > > co-efficients for low pass 4th order filter?? > > > Thanks a bunch > > Vj > > Somewhere in that discussion the cutoff frequency and the sampling rate > get dropped -- also if you look at the "any DSP text" that he references > you'll find that pole warping is far more involved (but still doable) than > he states.actually, at least as far as the bilinear transform (BLT) is concerned, the "warping" and unwarping issues apply to signficant frequencies, not directly to the complex values of the poles (or zeros) themselves. if it's a Butterworth, there is exactly one significant frequency, the cutoff frequency, that gets warped (and should be compensated for that). if the s-plane transfer function is normalized (the significant frequency in rad/unit_time is 1), then the substitution is (stolen from the audio eq cookbook): 1 1 - z^-1 (normalized) s <-- ----------- * ---------- tan(w0/2) 1 + z^-1 where w0 = 2*pi*f0/Fs and f0 is the unnormalized significant (or cutoff) frequency. one can then make use of these trig identities: sin(w0) 1 - cos(w0) tan(w0/2) = ------------- (tan(w0/2))^2 = ------------- 1 + cos(w0) 1 + cos(w0) anyway, as far as i can tell, the analog Q for each Butterworth biquad stage in the LPF prototype is not changed by the warping effects of the BLT. if the order of the Butterworth, N, is even, then the Q is 1/Q = 2*cos(pi/N*(n+1/2)) where 0 <= n < N/2 if it's a simple Butterworth LPF or HPF, the biquad formula for coefficients is worked out (in the cookbook) and the frequency warping is taken care of. for BPF or BRF (notch) filters, i am not sure if it's as straightforward, but i think it is. maybe a little messier. for LPF, HPF, BPF, and BRF using Tchebyshev Type I or II (of which Butterworth is a limiting case), someone should work out the closed form solutions to the filters (assuming BLT and prewarping the single significant frequency) and publish it once and for all (maybe somebody did). they might also have to fudge the bandwidth of the BPF and BRF due to BLT frequency warping because the bandwidth gets compressed as the center frequency gets closer to Nyquist. i had a simple first- order fudging factor that i used to map the bandwidth in octaves of the target digital filter to bandwidth in octaves of the prototype analog filter: BW = w0/sin(w0) * bw BW is for the analog prototype, bw is the bandwidth (in units of log frequency) of the design target. it's not perfect, but it's not too bad. r b-j
Reply by ●October 16, 20072007-10-16
boy, that didn't wrap well. i wish Google Groups would allow us to turn off word wrapping. this is better: On Oct 16, 2:06 pm, robert bristow-johnson <r...@audioimagination.com> wrote:> > if the s-plane transfer function is normalized (the significant > frequency in rad/unit_time is 1), then the substitution is (stolen > from the audio eq cookbook): > > 1 1 - z^-1 > (normalized) s <-- ----------- * ---------- > tan(w0/2) 1 + z^-1 > > where w0 = 2*pi*f0/Fs > > and f0 is the unnormalized significant (or cutoff) frequency. > > one can then make use of these trig identities: > > sin(w0) 1 - cos(w0) > tan(w0/2) = ------------- (tan(w0/2))^2 = ------------- > 1 + cos(w0) 1 + cos(w0)r b-j
Reply by ●October 16, 20072007-10-16
Thanks,Tim. I got hold of a Oppenheim & Schafer textbook and working out a formula for the co-efficients for the fourth order low pass filter. But if I have 2 second order low pass filters in cascade, can I use the second order co-efficients for both the filters..I mean using the second order formula.
Reply by ●October 16, 20072007-10-16
Thanks Robert. Thats a complex math for a fourth order LPF.Wish there is a generic formula for the coefficients.This website does http://www.apicsllc.com/apics/Sr_3/Sr_3.htm but its not right.
Reply by ●October 16, 20072007-10-16
On Oct 16, 2:17 pm, right05 <vidu...@gmail.com> wrote:> Thanks Robert. Thats a complex math for a fourth order LPF.Wish there > is a generic formula for the coefficients.This website doeshttp://www.apicsllc.com/apics/Sr_3/Sr_3.htmbut its not right.Hello, See if my paper helps ou out. http://www.claysturner.com/dsp/Butterworth%20Filter%20Formulae.pdf IHTH, Clay