Combining first-order filters to produce 2nd order filters?

Started by MrE 5 years ago16 replieslatest reply 5 years ago2111 views

I have been attempting to generate A & C weighted filters without success. I have tried multiple approaches but the simplest approach was to generate the coefficients for single-pole filters, then cascade those filters. Unfortunately the results of cascading the single-pole filters is not producing the desired outcome

My biquad filter function has been working for over a year without issue so I don’t believe that is the issue.  I give it second-order coefficients and it performs the filtering.  A few months ago, I identified a 6th order set of coefficients (3 biquads) at 48000Hz that is nearly perfect. It has a negligible two-tenths (0.2db) decibels error which I’ve proven to be true with my filter function  The coefficients are found here

Using those coefficients, I could upsample my data but I would like to stick with my desired sampling frequency of 44100.

  1. High Pass: 20.598997
  2. High Pass: 20.598997
  3. High Pass: 107.65265
  4. High Pass: 737.86223
  5. Low Pass: 12194.217
  6. Low Pass: 12194.217
  • I been looking back but why wouldn’t the simplest method of cascading first order filters work?
  • Is there a method for combining first-order filter coefficients to create a second order filter.
    • Math-magic… Single-order(1) [b0,b1,b2,1,a1,a2] + Single-order(2) [b0,b1,b2,1,a1,a2] = Second-order [b0,b1,b2,1,a1,a2]
  • Can you take a series of first order filter and reduce them to a series of second order filters?

I am speaking from naiveté but if that is true, it would seem that you could generate a parametric filter (an arbitrary amplitude response) from a series of first order filters and then reduce them to second-order sections.  Is this plausible?

Thank you.


[ - ]
Reply by jbrowerMarch 5, 2018


Are you testing filter implementation on a floating-point platform or device ?  Or a fixed-point device ... TI DSP for example.


[ - ]
Reply by MrEMarch 5, 2018

floating point is what I am using.

[ - ]
Reply by jbrowerMarch 5, 2018


Ok thanks.  My first thought was that cascading anything IIR might run into numerical issues, especially so if fixed-point is somewhere in the picture.  A ton of stuff out there talking about "numerical sensitivity", quantization effects, etc and it used to make me very nervous in the old DSP days.

But it looks like the other answers have pointed out the correct path to investigate.


[ - ]
Reply by Tim WescottMarch 6, 2018

It's not cascading IIR filters that lands you in numerical difficulty.  You want filters of as low an order as possible, which is 1st or 2nd, depending on the nature of the filter poles.

[ - ]
Reply by jbrowerMarch 6, 2018

Tim, thanks, right.  Theoretically, cascading 1st or 2nd order filers is intended to help.  What I was concerned about is during testing if something is slightly off and gets amplified by subsequent sections, then final output makes no sense.  It's touchy.  What I remember we used to do with fixed-point DSPs was carefully check the output from each filter (typically a biquad section), and look for unexpected level of noise, slight oscillations, etc.  If anything showed up, we had to fix that first.

I was not clear, sorry.


[ - ]
Reply by Tim WescottMarch 12, 2018

(Sorry for the slow response).  Ah, I see.  That's still an issue with floating point.  Even if you've got more than enough overhead in theory-land, there's still bugs -- and if you're doing single-precision floating point, you can't count on a pro-audio quality signal path.

[ - ]
Reply by jms_nhMarch 5, 2018

Implementing 2nd-order filters by cascading two 1st-order filters works, but it only works for filters that are critically damped or overdamped. Butterworth filters, for example, have 2nd-order terms of \(s^2 + as + 1\) (when cutoff frequency is normalized) where the linear term constant "a" is less than 2, so the poles are not both real, and you can't achieve them by cascading two 1st-order filters that have real coefficients.

Going the other way --- taking two cascaded first-order filters and implementing them as a single 2nd-order filter --- doesn't have limitations but there are always limitations of the specific filter implementations. (overflow, noise sensitivity, limit cycles, etc.)

[ - ]
Reply by SteveSmithMarch 5, 2018

No, it's not possible in general.  In an arbitray second-order filter there is an interaction between the parameters that cannot be duplicated in a simple cascade of two first-order filters.  

In terms of a pole-zero plot, the cascade will always be just two poles on the real axis. The second-order filter, in contrast, allows the poles to move off of the real axis, giving a far more complicated behaviour.

Here's a reference if you are interested.

[ - ]
Reply by MrEMarch 5, 2018

I'll go back and revisit the reference.  I've used this to get an understanding of a subject out of my depth.  It definitely has been helpful and thank you for reminding me of this resource.

[ - ]
Reply by MrEMarch 5, 2018

I've received a few responses of "No" unless there are other circumstance that permit this.  I'm actually very grateful for those No responses because I pursue some other (hopefully) productive line of reasoning. 

I'll revisit one of the earlier questions, why wouldn’t the simplest method of cascading first order filters work? 

It seems strange to me that when I look at a diagram of the filter, it is just a series of first order filters so I thought, this should be a snap to generate those coefficients and feed them into each other, (cascading) and I would have been done months ago but that has been far from the truth.  

It wouldn't be as efficient to have six single-pole filter as it would to have three biquads but at this point, I could live with that.

[ - ]
Reply by Tim WescottMarch 6, 2018

"why wouldn’t the simplest method of cascading first order filters work?"

Because you need to decompose the filter into sections that have real coefficients.  The decomposition happens by factoring the numerator and denominator polynomials.  It turns out (because the roots of a real-valued polynomial are either real or come in conjugate pairs) that this decomposition can only be down to 1st-order polynomials in special circumstances, but can always be done down to 2nd-order polynomials.

[ - ]
Reply by dudelsoundMarch 6, 2018

In a two-pole filter you can create conjugate complex pole-pairs - in a single-pole filter you can only create real poles - unless you have complex coefficients, which - usually - you don't...

So, in the s-plane you will have poles only on the negative real axis if you use cascaded single-pole filters...

[ - ]
Reply by fred_harrisMarch 6, 2018

Mr E.

I ran the coefficients of the A-weighted filters you identified in(

The coefficients for each biquad form filters with real poles and real zeros which means they can be implemented as a cascade of 6 single pole-zero stages with appropriate scale factor to limit the maximum spectral gain of each stage. As long as there are no complex roots in your filter, the filter can be fully implemented with first order sections. 


[ - ]
Reply by jtp_1960March 7, 2018
Are you facing the response issue BLT implementation gives or is it other issues you have there with your own biquad implementation?

screenshot from 2018-03-07 09:30:50_8826
[ - ]
Reply by MrEMarch 11, 2018

I've read about direct-form 1, direct-form 2, and transposed direct forms.

I have ever so slight concern that this an implementation specific issue with the biquad implementation.  I have a built in function that implements the direct-form 1 that I had been using for more than a year.  Since the built-in function is a black box, I also developed (a year ago) a function that utilizes the same direct-form 1 and I obtain nearly the same results (slight precision difference).  The built-in function is far baster but the formulae I utilize is 

y[n] = a0*x[n] + a1*x[n-1] + a2*x[n-2] - b1*y[n-1] - b2*y[n-2]

I've read that direct-form 1 is not as efficient but it less likely to have overflow issues.  I am not good with math, but I followed the formula and so far, I haven't had any issues but maybe that is because my implementation has matched my previous needs.

I haven't followed the graphs but I generate the coefficients and apply frequencies in 1/3 octaves from 20-20Khz and view the difference between the expected and the actual results.  The results I obtain at times follow the expected results closely either below 4000Hz or above but never both.

[ - ]
Reply by dszaboMarch 15, 2018

I’m having trouble understanding what you’re trying to do, what troubles you’re having and what your comfort level with DSP mathematics is. I hope that answering your questions directly may help inform the discussion.

Cascading first order filters will work, at least in so far as you have described it. You have specified 6 first order filters, that can be implemented by cascading 6 first order filters.  I’m not familiar with implementing weighting filters, so I can’t say that your specs are consistent with the standard.

A cascade of two first order filters can be implemented with a second order filter.  However, not all second order filters can be realized with a cascade of two first order filters, this has been pointed out by the other contributors.  What you would want to do is express each first order filter in terms of its transfer function, H(z).  Multiply the two transfer functions and you will get a second order transfer function and the corresponding filter coefficients.

You can’t build a proper parametric filter using first order filters. A parametric filter would have a filter shape (bell, low pass, etc) and parameters for controlling frequency and Q.  Because the poles and zeros in the transfer function would be limited to the real axis, you would be limited to Qs of less than or equal to 0.5.

Good luck