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

Started by 6 years ago16 replieslatest reply 6 years ago2653 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 http://jenshee.dk/signalprocessing/aweighting.pdf

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.

MrE.

[ - ]

Jens-

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

-Jeff

[ - ]

floating point is what I am using.

[ - ]

Jens-

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.

-Jeff

[ - ]

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.

[ - ]

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.

-Jeff

[ - ]

(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.

[ - ]

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.)

[ - ]

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.

http://www.dspguide.com/CH19.PDF

[ - ]

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.

[ - ]

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.

[ - ]

"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.

[ - ]

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...

[ - ]

Mr E.

I ran the coefficients of the A-weighted filters you identified in(http://jenshee.dk/signalprocessing/aweighting.pdf)

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.

fred

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

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.

[ - ]