DSPRelated.com
Forums

IIR BandPass nominator

Started by Blaazen February 20, 2011
Hello everybody,

I have problem with nominator of H(z) of bandpass filter.
I develop musical open-source software (non-commercional) and I wrote my
filter-design algorithms based on polynomials (without complex aritmetic).
I have all working well (Bessel, Butterworth, Chebyshev, inverse Chebyshev
and Cauer's elliptic filters Low, High Band pass and band Reject).
Now I decided do rewrite my algorithms to zero-pole design with complex
numbers. I started with Butterworth filters. I have LP & HP and works well
(design is almost 8 times faster, filters are more stable and ussualy I can
get higher order of it).
But here comes the band-pass problem. In my previous solution I made
frequency transform at s-plane polynomial (s -> ( s^2+w0^2)/(s*dw) ). But
how can I do this when I have no polynomial but only transformed poles?
For example, unnormalized z-nominator of 4-th order BP seems like: [1, -2,
1]
But how can I make it normalized?
(Note that denumerators (poles) are OK (compared to another software and
also to my previous solution).)

Thanks for any help.


On 02/20/2011 12:15 PM, Blaazen wrote:
> Hello everybody, > > I have problem with nominator of H(z) of bandpass filter. > I develop musical open-source software (non-commercional) and I wrote my > filter-design algorithms based on polynomials (without complex aritmetic). > I have all working well (Bessel, Butterworth, Chebyshev, inverse Chebyshev > and Cauer's elliptic filters Low, High Band pass and band Reject). > Now I decided do rewrite my algorithms to zero-pole design with complex > numbers. I started with Butterworth filters. I have LP& HP and works well > (design is almost 8 times faster, filters are more stable and ussualy I can > get higher order of it). > But here comes the band-pass problem. In my previous solution I made > frequency transform at s-plane polynomial (s -> ( s^2+w0^2)/(s*dw) ). But > how can I do this when I have no polynomial but only transformed poles? > For example, unnormalized z-nominator of 4-th order BP seems like: [1, -2, > 1] > But how can I make it normalized? > (Note that denumerators (poles) are OK (compared to another software and > also to my previous solution).)
Can you cite a reference for how you're doing this with complex numbers? Since I'm not sure exactly what you're doing I can't say for sure -- but why don't you try transforming each bandpass stage to a 2nd-order filter, then doing your complex pole magic on that? -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
>Can you cite a reference for how you're doing this with complex numbers? > >Since I'm not sure exactly what you're doing I can't say for sure -- but >why don't you try transforming each bandpass stage to a 2nd-order >filter, then doing your complex pole magic on that? > >-- > >Tim Wescott >Wescott Design Services >http://www.wescottdesign.com > >Do you need to implement control loops in software? >"Applied Control Theory for Embedded Systems" was written for you. >See details at http://www.wescottdesign.com/actfes/actfes.html >
I made mistake in my previous message. Unnormalized nominator of each 4-th order BP filter is [1, 0, -2, 0, 1] of course. I exactly do (example for 2-nd order low-pass prototype): 1) I calculate 2 complex poles of Butterworth low-pass prototype (it is 1 conjugate pair) 2) I transform them into 4 complex poles (2 conj. pairs) together with frequency transform - now it is Bandpass filter 3) I apply Bilinear-Z transform for these 2 conj. pairs and I have 4 complex poles on Z-plane now. 4) Now I calculate denumerator of H(z): (1-2*Re+Re*Re+Im*Im) etc. This works well for all even prototypes. But I don't know how to get nominator. I feel I am very near of my goal but still missing last piece of puzzle :-) Thanks for reply.
Mistake again.

>4) Now I calculate denumerator of H(z): (1-2*Re+Re*Re+Im*Im) etc. >This works well for all even prototypes.
I meant: 2 poles on Z-Plane [Re1, Im1] and [Re2, Im2] -> -> -> [1, -2*Re1, Re1^2+Im1^2]*[1, -2*Re2, Re2^2+Im2^2] (of course only 2 of 4 poles are necessary because they are conjugate)
On 02/20/2011 02:09 PM, Blaazen wrote:
>> Can you cite a reference for how you're doing this with complex numbers? >> >> Since I'm not sure exactly what you're doing I can't say for sure -- but >> why don't you try transforming each bandpass stage to a 2nd-order >> filter, then doing your complex pole magic on that? >> >> -- >> >> Tim Wescott >> Wescott Design Services >> http://www.wescottdesign.com >> >> Do you need to implement control loops in software? >> "Applied Control Theory for Embedded Systems" was written for you. >> See details at http://www.wescottdesign.com/actfes/actfes.html >> > > I made mistake in my previous message. Unnormalized nominator of each 4-th > order BP filter is [1, 0, -2, 0, 1] of course. > I exactly do (example for 2-nd order low-pass prototype): > 1) I calculate 2 complex poles of Butterworth low-pass prototype (it is 1 > conjugate pair) > 2) I transform them into 4 complex poles (2 conj. pairs) together with > frequency transform - now it is Bandpass filter > 3) I apply Bilinear-Z transform for these 2 conj. pairs and I have 4 > complex poles on Z-plane now. > 4) Now I calculate denumerator of H(z): (1-2*Re+Re*Re+Im*Im) etc. > This works well for all even prototypes. > > But I don't know how to get nominator. I feel I am very near of my goal but > still missing last piece of puzzle :-) > > Thanks for reply.
I was confused a bit by your terminology -- you're using nominator and denumerator, while the usual terminology is numerator (the 'top part') and denominator (the 'bottom part'). So I didn't realize that your concern was purely over normalization. I can think of two things to try: One: do the bilinear transformation on the numerator as well as the denominator. This should get you close. Two: Test the filter gain at the center frequency, by plugging in z = e^(j * th), with th = the bandpass frequency in radians/sample. Then adjust the gain as necessary to get what you want. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
>I was confused a bit by your terminology -- you're using nominator and >denumerator, while the usual terminology is numerator (the 'top part') >and denominator (the 'bottom part'). > >So I didn't realize that your concern was purely over normalization. > >I can think of two things to try: > >One: do the bilinear transformation on the numerator as well as the >denominator. This should get you close. > >Two: Test the filter gain at the center frequency, by plugging in z = >e^(j * th), with th = the bandpass frequency in radians/sample. Then >adjust the gain as necessary to get what you want. > >--
Sorry for confusing. My english is not perfect :-). Probably you mean: th = sqrt(wch*wcl) (center freq. is geometric mean of pre-warped low and high band cutoff frequencies) I use this simple algorithm: It simply transform one pole of prototype into two poles of band-pass. Pole:=0.5*(Spoles[i]*BW); help:=csqrt(1.0 - sqr(W0 / Pole)); Spoles[i]:=Pole*(1.0 + help); Spoles[pairs+i]:=Pole*(1.0 - help); It works well, then I do BLT-Z transform and my denominators are fine. But how can I apply this on zeros. For example Butterworth filter prototype has all zeros in infinity. Well, 4-order Bandpass filter has 4 (complex) zeros on z-plane: 1+i*0 1+i*0 -1+i*0 -1+i*0 so numerator of H(z) become: [1, 0, -2, 0, 1] When numerator=denominator at center freqency then it is normalized. e^(j * th)= cos(th) + i*sin(th) Is it the right way?
On 02/21/2011 05:09 AM, Blaazen wrote:
>> I was confused a bit by your terminology -- you're using nominator and >> denumerator, while the usual terminology is numerator (the 'top part') >> and denominator (the 'bottom part'). >> >> So I didn't realize that your concern was purely over normalization. >> >> I can think of two things to try: >> >> One: do the bilinear transformation on the numerator as well as the >> denominator. This should get you close. >> >> Two: Test the filter gain at the center frequency, by plugging in z = >> e^(j * th), with th = the bandpass frequency in radians/sample. Then >> adjust the gain as necessary to get what you want. >> >> -- > > Sorry for confusing. My english is not perfect :-). > > Probably you mean: th = sqrt(wch*wcl) (center freq. is geometric mean of > pre-warped low and high band cutoff frequencies) > > I use this simple algorithm: > It simply transform one pole of prototype into two poles of band-pass. > > Pole:=0.5*(Spoles[i]*BW); > help:=csqrt(1.0 - sqr(W0 / Pole)); > Spoles[i]:=Pole*(1.0 + help); > Spoles[pairs+i]:=Pole*(1.0 - help); > > It works well, then I do BLT-Z transform and my denominators are fine. > > But how can I apply this on zeros. For example Butterworth filter prototype > has all zeros in infinity. > > Well, 4-order Bandpass filter has 4 (complex) zeros on z-plane: > 1+i*0 > 1+i*0 > -1+i*0 > -1+i*0 > so numerator of H(z) become: [1, 0, -2, 0, 1] > > When numerator=denominator at center freqency then it is normalized. > > e^(j * th)= cos(th) + i*sin(th) > > Is it the right way?
Yes. It may be better to ask that |numerator| = |denominator| at the center frequency, although I think the phase shift will, indeed, be zero. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Yes, I got it.

There was problem with Center Frequency.

I have to prewarp both (low and high) band frequencies and then make their
geometric mean wcGM=sqrt(wcL*wcH). But it is not all. There is necessary do
wcGM1=2*arctan(wcGM/2).

With this wcGM1 it gives precious result on all decimal places.

Thank you very much.