Reply by marcin123 March 26, 20122012-03-26
>(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 >
Hi Tim, and others. I just discovered I didn't thank you for your answers back when I needed them. They helped me a lot. Sorry, and thank you.
Reply by Jerry Avins February 23, 20122012-02-23
On 2/22/2012 2:15 PM, robert bristow-johnson wrote:
> 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.
N includes the zeroth derivative, which can't be diddled. so you're right. Thanks. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by Clay February 23, 20122012-02-23
On Feb 22, 12:23&#4294967295;pm, robert bristow-johnson
<r...@audioimagination.com> 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. &#4294967295;2N+1 knobs that can be twisted in arbitrary amounts. > > there are (for a canonical form) N states. &#4294967295;is that what you mean, Jerry? > > -- > > r b-j &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;r...@audioimagination.com > > "Imagination is more important than knowledge."
For a butterworth, the normalized amplitude function is (1+w^2N)^-0.5, where w is radian frequency and N is the filter order. The zeroth order derivative can't be zero, hence the nominal value of 1 for w==DC. But then the next 2N-1 derivatives of the amplitude function are zero at DC. Other types of lowpass IIR filters, chebyshevs, for example have an amplitude function (1+epsilon*P(w))^-0.5 where P(w) is a polynomial of order 2N. When P(w) = w^2N, we maximize the number of derivatives = 0 at w==0. This is why a butterworth filter is often described as maximally flat at DC. Clay
Reply by stan 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
Reply by robert bristow-johnson 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 Jerry Avins 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. &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;
Reply by robert bristow-johnson 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 Tim Wescott 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 Jerry Avins 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. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by Tim Wescott 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