Forums

2 one-pole filters in series

Started by Emile April 5, 2009
Hi,

im working on a schoolproject to render sound in a virtual environment.
To do that i calculate sound propagation paths.
At the moment i model wall soundabsorption with onepole lowpass filters.
Some paths bounce of several walls, causing several onepole filters 
working in series.
I update my paths at about 25Hz and filtering i do in timedomain at 44100Hz.
Now i would like to replace the series of filters, when i update the 
soundpaths at 25Hz, with 1 filter. (the more i think about it the more i 
think this will be premature optimization, and thus evil, but still)
I have tried an experiment in matlab, but it seems i cant just multiply 
/add coefficients (you probably think: duh!)

So say i have 2 onepole filters k and l, an inputsignal x and 
outputsignal y. Then i would like to know how to compute the filter f if:

y = k(l(x)) = f(x)
On Sun, 05 Apr 2009 18:03:57 +0200, Emile wrote:

> Hi, > > im working on a schoolproject to render sound in a virtual environment. > To do that i calculate sound propagation paths. At the moment i model > wall soundabsorption with onepole lowpass filters. Some paths bounce of > several walls, causing several onepole filters working in series. > I update my paths at about 25Hz and filtering i do in timedomain at > 44100Hz. Now i would like to replace the series of filters, when i > update the soundpaths at 25Hz, with 1 filter. (the more i think about it > the more i think this will be premature optimization, and thus evil, but > still) I have tried an experiment in matlab, but it seems i cant just > multiply /add coefficients (you probably think: duh!) > > So say i have 2 onepole filters k and l, an inputsignal x and > outputsignal y. Then i would like to know how to compute the filter f > if: > > y = k(l(x)) = f(x)
It's interesting that you should ask this... You don't want to combine lower order filters into higher order ones like this. You want to go ahead and cascade them. The reason is because when the filters are combined the resulting filter's sensitivity to coefficient and data precision goes up roughly with the filter order. So in general, when you've just done some theoretical work and come up with a nice shiny specification for a high-order IIR* filter, the first thing you want to do is break it down into first- and second-order sections to be cascaded. You _do_ want to know how to do this, because you'll want to be able to do it in reverse, and you need to know how to do it when you're analyzing systems. In that case, the easiest way to do it in the long run is to learn how to use the z transform; this turns the problem of solving difference equations (which is what your time-domain description of the filter is) into a problem involving multiplication of polynomials, which is much easier. So take a look here http://www.wescottdesign.com/articles/zTransform/z- transforms.html and see what you think. Wikipedia also has a section on the z transform. You'll either find yourself frustrated at the terseness of the presentation or at the brevity -- this is because a proper treatment of the z transform and all the things you'll want to do with it can take several book chapters. Fortunately the z transform is well treated in various signal processing and control systems books (including mine: http://www.wescottdesign.com/actfes/actfes.html), so there's material out there. * You are speaking of IIR, or "Infinite Impulse Response" filters -- the rules for Finite Impulse Response (FIR) filters are different. -- http://www.wescottdesign.com
On Apr 6, 4:03&#2013266080;am, Emile <bla.a...@telenet.be> wrote:
> Hi, > > im working on a schoolproject to render sound in a virtual environment. > To do that i calculate sound propagation paths. > At the moment i model wall soundabsorption with onepole lowpass filters. > Some paths bounce of several walls, causing several onepole filters > working in series. > I update my paths at about 25Hz and filtering i do in timedomain at 44100Hz. > Now i would like to replace the series of filters, when i update the > soundpaths at 25Hz, with 1 filter. (the more i think about it the more i > think this will be premature optimization, and thus evil, but still) > I have tried an experiment in matlab, but it seems i cant just multiply > /add coefficients (you probably think: duh!) > > So say i have 2 onepole filters k and l, an inputsignal x and > outputsignal y. Then i would like to know how to compute the filter f if: > > y = k(l(x)) = f(x)
Not a good idea since you can get instabilities (IIR filters have local feedback around them) due to finite word length. If you wanted to try you just multiply the polynomials together. For example if filter 1 is H(z)=1/(1-0.5z^-1) then just square this algebraically to get two in cascade.
Tim Wescott schreef, Op 5/04/2009 19:59:
> On Sun, 05 Apr 2009 18:03:57 +0200, Emile wrote: > >> Hi, >> >> im working on a schoolproject to render sound in a virtual environment. >> To do that i calculate sound propagation paths. At the moment i model >> wall soundabsorption with onepole lowpass filters. Some paths bounce of >> several walls, causing several onepole filters working in series. >> I update my paths at about 25Hz and filtering i do in timedomain at >> 44100Hz. Now i would like to replace the series of filters, when i >> update the soundpaths at 25Hz, with 1 filter. (the more i think about it >> the more i think this will be premature optimization, and thus evil, but >> still) I have tried an experiment in matlab, but it seems i cant just >> multiply /add coefficients (you probably think: duh!) >> >> So say i have 2 onepole filters k and l, an inputsignal x and >> outputsignal y. Then i would like to know how to compute the filter f >> if: >> >> y = k(l(x)) = f(x) > > It's interesting that you should ask this... > > You don't want to combine lower order filters into higher order ones like > this. You want to go ahead and cascade them. The reason is because when > the filters are combined the resulting filter's sensitivity to > coefficient and data precision goes up roughly with the filter order. > > So in general, when you've just done some theoretical work and come up > with a nice shiny specification for a high-order IIR* filter, the first > thing you want to do is break it down into first- and second-order > sections to be cascaded. > > You _do_ want to know how to do this, because you'll want to be able to > do it in reverse, and you need to know how to do it when you're analyzing > systems. In that case, the easiest way to do it in the long run is to > learn how to use the z transform; this turns the problem of solving > difference equations (which is what your time-domain description of the > filter is) into a problem involving multiplication of polynomials, which > is much easier. > > So take a look here http://www.wescottdesign.com/articles/zTransform/z- > transforms.html and see what you think. Wikipedia also has a section on > the z transform. You'll either find yourself frustrated at the terseness > of the presentation or at the brevity -- this is because a proper > treatment of the z transform and all the things you'll want to do with it > can take several book chapters. Fortunately the z transform is well > treated in various signal processing and control systems books (including > mine: http://www.wescottdesign.com/actfes/actfes.html), so there's > material out there. > > * You are speaking of IIR, or "Infinite Impulse Response" filters -- the > rules for Finite Impulse Response (FIR) filters are different. >
Thx, nice complete explanation. I have read about and tried to understand the z transform some time ago, but wasn't properly motivated at the time. But when you know that this kind of problem can be solved with it (and roughly how), and knowing that upfront makes me wanna revisit the theory.