Some time ago I've programmed a 2'nd order Butterworth High-Pass filter using the tool: http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html. I noticed it always generated filters which transfer function in the discrete time domain would be: (1) y0 = (b0*x0 + b1*x1 + b2*x2 - a1*y1 - a2*y2) / a0 (2) b0 + b1 + b2 = 0 (3) b0 = b2 (4) a0 + a1 + a2 = 0, where: y0 - output at current time step, y1 - previous output y2 - output two steps before, x0, x1, x2 - analogical to y a, b - filter coefficients Is it a rule for Butterworth filters to be designed with such coefficients (equations 2-4, but 2 and 3 especially)? Or is it possible to design a Butterworth filter which wouldn't obey those equations (2-4)? If possible, could you please explain what is the physical consequence of this choice of coefficients?
Discrete high-pass Butterworth filter design rules
Started by ●February 22, 2012
Reply by ●February 22, 20122012-02-22
On 2/22/2012 10:20 AM, marcin123 wrote:> Some time ago I've programmed a 2'nd order Butterworth High-Pass filter > using the tool: http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html. > I noticed it always generated filters which transfer function in the > discrete time domain would be: > > (1) y0 = (b0*x0 + b1*x1 + b2*x2 - a1*y1 - a2*y2) / a0 > (2) b0 + b1 + b2 = 0 > (3) b0 = b2 > (4) a0 + a1 + a2 = 0, > > where: > y0 - output at current time step, > y1 - previous output > y2 - output two steps before, > x0, x1, x2 - analogical to y > a, b - filter coefficients > > Is it a rule for Butterworth filters to be designed with such coefficients > (equations 2-4, but 2 and 3 especially)? Or is it possible to design a > Butterworth filter which wouldn't obey those equations (2-4)? If possible, > could you please explain what is the physical consequence of this choice of > coefficients?A filter of order N has N degrees of freedom. A Butterworth low-pass filter uses those freedoms to set the first N derivatives of the magnitude response to zero at f = 0. Take it from there. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●February 22, 20122012-02-22
On 2/22/12 11:33 AM, Jerry Avins wrote:> > A filter of order N has N degrees of freedom.?? if you include IIR, i always thought that an Nth order filter has 2N+1 degrees of freedom. 2N+1 knobs that can be twisted in arbitrary amounts. there are (for a canonical form) N states. is that what you mean, Jerry? -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●February 22, 20122012-02-22
On Wed, 22 Feb 2012 09:20:19 -0600, marcin123 wrote:> Some time ago I've programmed a 2'nd order Butterworth High-Pass filter > using the tool: > http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html. I noticed it > always generated filters which transfer function in the discrete time > domain would be: > > (1) y0 = (b0*x0 + b1*x1 + b2*x2 - a1*y1 - a2*y2) / a0 > (2) b0 + b1 + b2 = 0 > (3) b0 = b2 > (4) a0 + a1 + a2 = 0, > > where: > y0 - output at current time step, > y1 - previous output > y2 - output two steps before, > x0, x1, x2 - analogical to y > a, b - filter coefficients > > Is it a rule for Butterworth filters to be designed with such > coefficients (equations 2-4, but 2 and 3 especially)? Or is it possible > to design a Butterworth filter which wouldn't obey those equations > (2-4)? If possible, could you please explain what is the physical > consequence of this choice of coefficients?(1) is the cannonical difference equation for a 2nd-order IIR filter. (2) and (3) place a double zero at DC, insuring "high-pass-ness" (4) is exceptionally hard to believe, because it places a pole at DC, which not only makes the filter metastable, but forces the other pole to be real. The filter should be of the form a1/a0 = -2 * cos(theta) and a2/a0 = d^2, where theta is the filter's natural frequency in radians/sample, and d is a function of theta that establishes the filter's "Butterworth-ness" (I don't know what it is off the top of my head -- I almost exclusively do control and comm stuff, neither of which calls for this sort of filter). Since |2 * cos(theta)| < 2 for all real-valued and non- trivial values of theta, and since |d| < 1 for a stable filter, your rule (4) just cannot be. Are you sure that you're looking at all the digits, and is the software right? -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
Reply by ●February 22, 20122012-02-22
On 2/22/2012 12:23 PM, robert bristow-johnson wrote:> On 2/22/12 11:33 AM, Jerry Avins wrote: >> >> A filter of order N has N degrees of freedom. > > ?? > > if you include IIR, i always thought that an Nth order filter has 2N+1 > degrees of freedom. 2N+1 knobs that can be twisted in arbitrary amounts. > > there are (for a canonical form) N states. is that what you mean, Jerry?Sort of. A digital "Butterworth" of order N has 2N+1 coefficients. The analog form that it imitates with reasonable success, "maximally flat magnitude response*", for which G(w) = 1/sqrt(1+w^2n). This results directly from setting all derivatives equal to zero at f=0. The different digital approximations (impulse invariance, bilinear transform) yield different filters. So what I meant was zeroing all accessible derivatives of the analog filter and deriving the digital approximation from the result. Jerry _________________________________ * a Chebychev Type 2 filter of the same order is flatter in the passband at the price of stopband ripple. -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●February 22, 20122012-02-22
On Wed, 22 Feb 2012 13:34:50 -0500, Jerry Avins wrote:> On 2/22/2012 12:23 PM, robert bristow-johnson wrote: >> On 2/22/12 11:33 AM, Jerry Avins wrote: >>> >>> A filter of order N has N degrees of freedom. >> >> ?? >> >> if you include IIR, i always thought that an Nth order filter has 2N+1 >> degrees of freedom. 2N+1 knobs that can be twisted in arbitrary >> amounts. >> >> there are (for a canonical form) N states. is that what you mean, >> Jerry? > > Sort of. A digital "Butterworth" of order N has 2N+1 coefficients. The > analog form that it imitates with reasonable success, "maximally flat > magnitude response*", for which G(w) = 1/sqrt(1+w^2n). This results > directly from setting all derivatives equal to zero at f=0. The > different digital approximations (impulse invariance, bilinear > transform) yield different filters. > > So what I meant was zeroing all accessible derivatives of the analog > filter and deriving the digital approximation from the result.Actually it's the _low pass_ Butterworth that's maximally flat at f=0 -- the high-pass Butterworth, in the continuous-time domain, is derived by substituting s_hp = w_0^2/s_lp to get the high-pass equivalent. The consequence is a filter that is maximally flat in the _high_ frequencies. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
Reply by ●February 22, 20122012-02-22
On 2/22/2012 1:44 PM, Tim Wescott wrote: ...> Actually it's the _low pass_ Butterworth that's maximally flat at f=0 -- > the high-pass Butterworth, in the continuous-time domain, is derived by > substituting s_hp = w_0^2/s_lp to get the high-pass equivalent. > > The consequence is a filter that is maximally flat in the _high_ > frequencies.Did I miss something i the original post? I was referring to the low-pass form. BAH! Not only text, but title. The G(w) I gave is wrong as well. Invert it. Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply by ●February 22, 20122012-02-22
On 2/22/12 1:34 PM, Jerry Avins wrote:> On 2/22/2012 12:23 PM, robert bristow-johnson wrote: >> On 2/22/12 11:33 AM, Jerry Avins wrote: >>> >>> A filter of order N has N degrees of freedom. >> >> ?? >> >> if you include IIR, i always thought that an Nth order filter has 2N+1 >> degrees of freedom. 2N+1 knobs that can be twisted in arbitrary amounts. >> >> there are (for a canonical form) N states. is that what you mean, Jerry? > > Sort of. A digital "Butterworth" of order N has 2N+1 coefficients.okay, you said "filter of order N", now you're qualifying which kind of filter. i would expect that tossing in such a qualification reduces the number of knobs. it seems to me that once "Butterworth" is tossed in and the order N is fixed, you have a switch (HPF, LPF, BPF, BRF), a knob for frequency and another knob for overall gain. 2.5 degrees of freedom. if you fix the switch to a setting, ain't the only controls what frequency to set and how much gain?> The > analog form that it imitates with reasonable success, "maximally flat > magnitude response*", for which G(w) = 1/sqrt(1+w^2n). This results > directly from setting all derivatives equal to zero at f=0.yeah, i know about that.> The > different digital approximations (impulse invariance, bilinear > transform) yield different filters.and that.> So what I meant was zeroing all accessible derivatives of the analog > filter and deriving the digital approximation from the result.oh, i see. for (analog) Butterworth, you have to assume no zeros, and in the denominator of |H(s)|^2, you have N-1 terms of w^2, w^4, etc., where you set the coefs to zero to get maximally flat. i see it as N-1 degrees, not N. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●February 22, 20122012-02-22
On 2/22/12 1:44 PM, Tim Wescott wrote:> > Actually it's the _low pass_ Butterworth that's maximally flat at f=0 -- > the high-pass Butterworth, in the continuous-time domain, is derived by > substituting s_hp = w_0^2/s_lp to get the high-pass equivalent. > > The consequence is a filter that is maximally flat in the _high_ > frequencies.and there are similar counterparts to the bandpass filter and the band-reject filter. orders get doubled in the transformation from the LPF prototype to the BPF or BRF. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●February 22, 20122012-02-22
Jerry Avins wrote:> On 2/22/2012 1:44 PM, Tim Wescott wrote: > > ... > >> Actually it's the _low pass_ Butterworth that's maximally flat at f=0 -- >> the high-pass Butterworth, in the continuous-time domain, is derived by >> substituting s_hp = w_0^2/s_lp to get the high-pass equivalent. >> >> The consequence is a filter that is maximally flat in the _high_ >> frequencies. > > Did I miss something i the original post? I was referring to the > low-pass form. > > BAH! Not only text, but title. The G(w) I gave is wrong as well. Invert it.Plasma? :O