16
$\begingroup$

One of the standard ways to implement a Butterworth filter is with a cascade of second-order sections, each corresponding to a pair of complex-conjugate poles. For a fourth-order filter, for example, there would be two second-order sections. If we consider how the pole locations for a lowpass filter change in the z-plane as the cutoff is designed for near 0hz to near Nyquist, the path "swept out" by each pair of poles corresponds to a pair of arcs inside the unit circle, as illustrated by the following figure [for fourth-order filters]:

Z-plane Pole Positions for Fourth-Order Butterworth Lowpass Filters

Given how long these filters have been around, and given the fact these "arcs" correspond to straight lines in the s-plane, it stands to reason that someone would have developed an implementation form with a single parameter which is able to sweep the poles along the arcs at "run time" [as opposed to "design time"]. However, I haven't come across anything like that yet.

It's relatively straightforward to come up with various ways of doing this, especially within segments of the range, and with a willingness to throw a little extra computation at it. What I'm wondering is the following:

Is there some standard way of implementing a tunable [digital] Butterworth filter of a given order that 1) has optimal properties (e.g. efficiency, robustness), and 2) covers the entire range?

Or is this really just such an easy problem that nobody bothers to talk about it? If that's the case, it seems like it would show up in filter design programs next to the options for "static" designs.

I did find this: A multiple purpose Butterworth filter with variable cutoff frequency, but at first Googling there doesn't seem to be much information about what's in it.

Update (re: answers)

Just to be a little more clear:

  • I'm looking for a "meta-design" with a parameter (say from [0,1]) that will automatically adjust the cutoff from DC to Nyquist (while keeping the gain normalized) for use in a time-varying system. Something like this two-pole resonator, except with Butterworth constraints. The idea is that calculating the parameter would be more efficient than going through the typical offline design procedure at runtime.
  • I'm not necessarily even looking for how to design a "meta-filter" (i.e. do the math with variables instead of numbers), I'm wondering whether there are choices for standard [non-obvious] implementation forms--because, say, the straightforward approach that corresponds to the static case ends up having numerical issues in the time-varying case.
  • Maybe there are no issues, and the straightforward approach is what's used in practice. That would be great. My concern is that I haven't seen this topic mentioned explicitly in any of the sources I've consulted, but maybe I just missed something really obvious, so I'm asking.
  • In the process of adding more detail here, I ran across a general treatment of parametric biquad structures, which is almost what I'm looking for (and has some nice references).

Update 2

I'm looking for answers like the one I put in my second comment to Jason R, as follows:

"Oh yeah, you want to use parametrization III-2b from so-and-so's thesis, in tapped state lattice form because it resolves such-and-such edge case while using the minimal number of multiplies."

Maybe nothing like that exists, but my question is whether it does, and if so, what is it, or where can I find it?

Jackpot

Based on a reference to "observer canonical form" given by Tim Wescott in the comp.dsp thread in Jason R's answer, I decided to assume that I might have to start digging around in the control systems literature, so I tried doing a search for butterworth "state space", and it turned up the following, very cool, treatment of designing/implementing, not only parametric Butterworth, but also Chebyshev and Elliptic filters:

Sophocles J. Orfanidis, "High-Order Digital Parametric Equalizer Design," J. Audio Eng. Soc., vol. 53, pp. 1026-1046, Nov. 2005.

It's going to take a little while to dig into, but based on what I've read so far, I'd be very surprised if it's not what I'm looking for. I'm giving this one to Jason R for the comp.dsp reference that led me to the Orfanidis paper. His answer is also a nice practical overview of designing Butterworth filters as well.

$\endgroup$
10
$\begingroup$

I'm not sure exactly what you're looking for. As you noted in your question, the transfer functions of the Butterworth filter family are well-understood and easily calculated analytically. It is pretty simple to implement a Butterworth filter structure that is tunable by filter order and cutoff frequency:

  1. Based on the selected filter order, cutoff frequency, and sample rate, calculate the pole locations for the Butterworth analog prototype filter. Since Butterworth filters have no zeros, the transfer function is determined by the pole locations (and the DC gain).

  2. Using the bilinear transform, map the pole locations of the analog prototype to their corresponding locations in your digital realization of the filter.

  3. Again, the digital filter is defined by the pole locations found in step 2. Break the filter into second-order sections by grouping the poles in pairs.

That's it. As I said, it's straightforward to programmatically design a Butterworth filter using whatever parameters you might need; none of the operations are terribly complicated to implement.

Edit: I'm not really sure what end result you're looking for. I think you're instead most interested in how to implement IIR filters with time-varying coefficients, not necessarily specific to a Butterworth filter. I assume your goal is to minimize artifacts when changing the filter cutoff frequency; this was covered in a discussion on the comp.dsp newsgroup earlier this year. While I'm not sure what your use case or requirements are for this filter structure, there are a number of ways to accomplish the switching.

I know you said you would like your filter to have a single parameter that defines the cutoff frequency, but the fact remains that your tunable structure must have a way to translate the cutoff frequency to the required coefficients (or in the Butterworth case, just the pole locations). The process I described above is appropriate for generating the pole locations based on the desired normalized sample rate.

You could potentially simplify the pole-location-calculation process by analyzing the geometry of the digital filter's pole locations in the z-plane. The analog Butterworth filter has poles that lie in a semicircle in the left half of the s-plane; the bilinear transform maps this semicircle into the elliptic-looking pattern that you illustrated in your question description. Using this known pattern to the analog Butterworth filter's poles, the mapping function of the bilinear transform, and some algebra, you may be able to come up with a relatively simple expression for the digital filter's pole locations, thus giving you more straightforward-looking filter tuning action.

$\endgroup$
  • $\begingroup$ Jason, I'm not looking for how to design a given Butterworth specification, I'm looking for a "meta-design". I'll update the question with a little more detail. $\endgroup$ – datageist Aug 21 '11 at 20:34
  • 1
    $\begingroup$ Re: Edit. The process you described in the last paragraph is exactly how I would approach it--I'm just wondering whether this has actually been covered anywhere. In other words, things like, "Oh yeah, you want to use parametrization III-2b from so-and-so's thesis, in tapped state lattice form because it resolves such-and-such edge case while using the minimal number of multiplies." $\endgroup$ – datageist Aug 22 '11 at 4:25
  • 1
    $\begingroup$ Small nit-picky comment: In the Z plane the BW filter does indeed have zeros. For low pass filters they are all at -1 and for high pass filters they are at +1. $\endgroup$ – Hilmar Aug 26 '12 at 5:11
  • $\begingroup$ @Hilmar: Good point. The zeros that you speak of correspond to the zeros that occur as $s \to \pm \infty$ in the $s$-plane (for lowpass filters; as $s \to 0$ for highpass). $\endgroup$ – Jason R Aug 27 '12 at 13:06
2
$\begingroup$

Yes there are standard implementation forms for Butterworth, and almost every other filter response. They are all fully implemented in my open source IIR filter library. Here's a snippet of code that produces the pole/zero pairs for a Butterworth filter of arbitrary degree:

void AnalogLowPass::design (int numPoles)
{
  if (m_numPoles != numPoles)
  {
    m_numPoles = numPoles;

    reset ();

    const double n2 = 2 * numPoles;
    const int pairs = numPoles / 2;
    for (int i = 0; i < pairs; ++i)
    {
      complex_t c = std::polar (1., doublePi_2 + (2 * i + 1) * doublePi / n2);
      addPoleZeroConjugatePairs (c, infinity());
    }

    if (numPoles & 1)
      add (-1, infinity());
  }
}

As you can see, the position of the poles are calculated by subdividing the s-plane into "pairs" equal segments.

Suitable code is provided for all common types of filter responses: Chebyshev, Elliptic, Legendre, including the shelf versions of each.

https://github.com/vinniefalco/DSPFiltersDemo.git

https://github.com/vinniefalco/DSPFilters.git

Screenshot

$\endgroup$
  • $\begingroup$ The DSPFilters library directly addresses the use-case contemplated by the original question, utilizing a parameterized equation to calculate pole/zero pairs of a digital filter at run-time. I will amend the answer to also include a source code snippet. $\endgroup$ – Vinnie Falco Aug 24 '12 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.