DSPRelated.com
Forums

1st Order IIR to 2nd Order IIR

Started by davidross March 22, 2006
Hi folks,

I was wondering if this is a truly valid method of going from a 1st Order
IIR lowpass transfer fucntion to a 2nd Order IIR lowpass transfer function
- 


1st Order Transfer Function :-

%             1 + z^-1
%   H(z) = b ----------
%             1 - az^-1


To go to 2nd Order multiply the numerator and denominator  - 

%             1 + z^-1      (1 + z^-1)(1 + z^-1)
%   H(z) = b ---------- = b --------------------
%             1 - az^-1     (1 - az^-1)(1 - az^-1)


Which arrives at :-

% 2nd Order Lowpass Transfer Function
%
%               1 + 2z^-1 + z^-2
%   H(z) = b ---------------------
%             1 - 2az^-1 + a^2z^-2


With this method, once I compute my coefficients I have to scale them for
the frequency response to be correct i.e. 0dB at frequency 0. If O dont
scale them the frequency response lies at about 20dB at frequency 0 i.e.
the frequency response increases linearly in dB across the frequency
range, or in other words, the frequency response appears to 'shift up' in
dB, as a result ofg not being normalized by the scaling. Incidentally teh
scaling I use is simply - 

% Coefficients
B = [b0 b1 b2];
A = [a0 a1 a2];

% Scale \ Normalize coefficients
B = B / sum(B)
A = A / sum(A)

But using this method of scaling seems strange, and the coefficients look
like unusually high values for coefficients.

So is this design method valid, or is it more of a 'hack' to get a 2nd
Order IIR from a 1st Order IIR transfer function?

Thanks for any views, 

Best Regards,
David
davidross wrote:
> Hi folks, > > I was wondering if this is a truly valid method of going from a 1st Order > IIR lowpass transfer fucntion to a 2nd Order IIR lowpass transfer function > -
[snip]
> So is this design method valid, or is it more of a 'hack' to get a 2nd > Order IIR from a 1st Order IIR transfer function?
I don't understand the context of the question. One usually have some sort of reason for choosing a particular order for the filter. I am not aware of any application where one starts out with a 1st order filter and then designs a 2nd order filter from that[*] The way one usually designs a filter, is that one starts out with a filter specification. The spec for a low-pass filter usually consists of such parameters as - Egde frequency of pass band, f_p - Edge frequency of stop band, f_s - Maximum ripple in pass band, d_p - Minimum attenuation of stop band, d_s Then the designer chooses what type of filter to implement, e.g. Butterworth, Chebuchev, Elliptic, or something else. Once the type of filter has been chosen, one can use the corresponding design formulas to determine the minimum order of the filter. Typically, the filter order is given in terms of the ratio N ~ (d_s-d_p)/(f_s-f_p) which is a fancy way to say that the filter order increases with increasing roll-off of the transfer function. Once the order of the filter is known, one can use the appropriate formulas to compute the 1st and 2nd order sections needed. Rune * This is what happens in some frequency tranforms, but there one uses the LP prototype to design a BP or BS filter that necessarily have twice the number of poles.
davidross wrote:
> Hi folks, > > I was wondering if this is a truly valid method of going from a 1st Order > IIR lowpass transfer fucntion to a 2nd Order IIR lowpass transfer function
If you want to square the magniutde response of your filter, then: yes, this is a truly valid method to do so. ...
> But using this method of scaling seems strange, and the coefficients look > like unusually high values for coefficients.
Why are you worried about how your coefficients look like? If your original filter was scaled to have a magnitude of 1 at some frequency, then the squared version also has magnitude of 1 at this frequency. If you want the new filter to have a magnitude of 1 at some other frequency, then you have to normalize. Regards, Andor
davidross wrote:

> I was wondering if this is a truly valid method of going from a > 1st Order IIR lowpass transfer fucntion to a 2nd Order IIR > lowpass transfer function - > > > 1st Order Transfer Function :- > > % 1 + z^-1 > % H(z) = b ---------- > % 1 - az^-1 > > > To go to 2nd Order multiply the numerator and denominator - > > % 1 + z^-1 (1 + z^-1)(1 + z^-1) > % H(z) = b ---------- = b -------------------- > % 1 - az^-1 (1 - az^-1)(1 - az^-1)
> With this method, once I compute my coefficients I have to scale > them for the frequency response to be correct i.e. 0dB at > frequency 0.
In case you chose b so that the first-order filter has unit DC gain, you need to square the whole thing instead of just the ratio of monic polynomials to keep that feature. Martin -- Quidquid latine scriptum sit, altum viditur.
>[snip] > >> So is this design method valid, or is it more of a 'hack' to get a 2nd >> Order IIR from a 1st Order IIR transfer function? > >I don't understand the context of the question.
Hi Rune, The question was probably 'out of context'. By squaring a 1st Order transfer function we can arrive at a 2nd order Transfer function, which goes from being 1st Order to 2nd Order due to the extra delay being added. However, the design method used to create the initial coefficients were arrived at via a 1st Order design. So I guess all this really does is (like a poster mentioned) 'square the magnitude response'. Maybe this would give the same magnitude response as cascading two 1st order sections?
>One usually have some sort of reason for choosing a particular order >for >the filter. I am not aware of any application where one starts out with > >a 1st order filter and then designs a 2nd order filter from that[*] > >The way one usually designs a filter, is that one starts out with a >filter specification. The spec for a low-pass filter usually consists >of such parameters as > >- Egde frequency of pass band, f_p >- Edge frequency of stop band, f_s >- Maximum ripple in pass band, d_p >- Minimum attenuation of stop band, d_s > >Then the designer chooses what type of filter to implement, e.g. >Butterworth, >Chebuchev, Elliptic, or something else. Once the type of filter has >been >chosen, one can use the corresponding design formulas to determine >the minimum order of the filter. Typically, the filter order is given >in terms of the ratio > > N ~ (d_s-d_p)/(f_s-f_p) > >which is a fancy way to say that the filter order increases with >increasing >roll-off of the transfer function. > >Once the order of the filter is known, one can use the appropriate >formulas to compute the 1st and 2nd order sections needed. > >Rune > >* This is what happens in some frequency tranforms, but there one > uses the LP prototype to design a BP or BS filter that necessarily > have twice the number of poles. > >
Nice overview of filter design there! I've made butterworth. From scratch and in real-time there quite tricky I found. Havent dared to look at Elliptic yet. I've heard there quite 'challenging' to design from scratch and the maths is quite involved so there on hold just now. I found even designing a second order butterworth filter from scratch quite tricky, but maybe I'm looking at the wrong references. Probably I shoudl start digging amongst the journals now. My original thinking about my post was - if i have a nice easy 1st order filter design algorithm - use it, square it, and then cascade it if need be, instead of delving into advanced elliptic design. Maybe its time too though. Best regards, David
>> I was wondering if this is a truly valid method of going from a 1st
Order
>> IIR lowpass transfer fucntion to a 2nd Order IIR lowpass transfer
function
> >If you want to square the magniutde response of your filter, then: yes, >this is a truly valid method to do so. >...
Good to hear. Basically by squaring it I was intending to improve the filter performance. A bit like cascading except done a different way.
>> But using this method of scaling seems strange, and the coefficients
look
>> like unusually high values for coefficients. > >Why are you worried about how your coefficients look like? If your >original filter was scaled to have a magnitude of 1 at some frequency, >then the squared version also has magnitude of 1 at this frequency. If >you want the new filter to have a magnitude of 1 at some other >frequency, then you have to normalize.
True, it shouldnt matter 'what they look like'. They just 'looked odd' some were always 0.25 exactly and some were as big as 50.blabla. I'm used to seeing coefficients like 0.098766865321. But I guess its nothing to worry about. Best Regards and thanks for the feedback, David
>davidross wrote: > >> I was wondering if this is a truly valid method of going from a >> 1st Order IIR lowpass transfer fucntion to a 2nd Order IIR >> lowpass transfer function - >> >> >> 1st Order Transfer Function :- >> >> % 1 + z^-1 >> % H(z) = b ---------- >> % 1 - az^-1 >> >> >> To go to 2nd Order multiply the numerator and denominator - >> >> % 1 + z^-1 (1 + z^-1)(1 + z^-1) >> % H(z) = b ---------- = b -------------------- >> % 1 - az^-1 (1 - az^-1)(1 - az^-1) > >> With this method, once I compute my coefficients I have to scale >> them for the frequency response to be correct i.e. 0dB at >> frequency 0. > >In case you chose b so that the first-order filter has unit DC gain, >you need to square the whole thing instead of just the ratio of monic >polynomials to keep that feature. > > >Martin > >-- >Quidquid latine scriptum sit, altum viditur. >
Hi Martin, Sounds like a good idea. I will include b this time and see what happens. Maybe if I include b I wont have to scale? Is that what you mean? Best Regards, David
"davidross" <david_ross@hotmail.co.uk> wrote in
news:1e2dnWT0m_Pu57TZRVn-pg@giganews.com: 

>>[snip] >> >>> So is this design method valid, or is it more of a 'hack' to get a >>> 2nd Order IIR from a 1st Order IIR transfer function? >> >>I don't understand the context of the question. > > > Hi Rune, > > The question was probably 'out of context'. By squaring a 1st Order > transfer function we can arrive at a 2nd order Transfer function, > which goes from being 1st Order to 2nd Order due to the extra delay > being added. However, the design method used to create the initial > coefficients were arrived at via a 1st Order design. So I guess all > this really does is (like a poster mentioned) 'square the magnitude > response'. Maybe this would give the same magnitude response as > cascading two 1st order sections?
Yes. This will give a you relatively lousy filter however. Generally, you decide the overall order of the filter based on your requirements. You then determine the transfer function. The coefficients will probably be different for each section. The filter program will break the poles and zeros out so you can determine the coefficients for each individual section. This is no different than designing a filter in the s plane. Two cascaded real poles are probably not as useful as a second order something else (butterworth, bessel, etc). If you are comparing IIR filters to typical analog filters you will find many similarities, however digital filters do not map exactly to an analog filter. -- Al Clark Danville Signal Processing, Inc. -------------------------------------------------------------------- Purveyors of Fine DSP Hardware and other Cool Stuff Available at http://www.danvillesignal.com
> > >>One usually have some sort of reason for choosing a particular order >>for >>the filter. I am not aware of any application where one starts out >>with >> >>a 1st order filter and then designs a 2nd order filter from that[*] >> >>The way one usually designs a filter, is that one starts out with a >>filter specification. The spec for a low-pass filter usually consists >>of such parameters as >> >>- Egde frequency of pass band, f_p >>- Edge frequency of stop band, f_s >>- Maximum ripple in pass band, d_p >>- Minimum attenuation of stop band, d_s >> >>Then the designer chooses what type of filter to implement, e.g. >>Butterworth, >>Chebuchev, Elliptic, or something else. Once the type of filter has >>been >>chosen, one can use the corresponding design formulas to determine >>the minimum order of the filter. Typically, the filter order is given >>in terms of the ratio >> >> N ~ (d_s-d_p)/(f_s-f_p) >> >>which is a fancy way to say that the filter order increases with >>increasing >>roll-off of the transfer function. >> >>Once the order of the filter is known, one can use the appropriate >>formulas to compute the 1st and 2nd order sections needed. >> >>Rune >> >>* This is what happens in some frequency tranforms, but there one >> uses the LP prototype to design a BP or BS filter that necessarily >> have twice the number of poles. >> >> > > Nice overview of filter design there! I've made butterworth. From > scratch and in real-time there quite tricky I found. Havent dared to > look at Elliptic yet. I've heard there quite 'challenging' to design > from scratch and the maths is quite involved so there on hold just > now. > > I found even designing a second order butterworth filter from scratch > quite tricky, but maybe I'm looking at the wrong references. Probably > I shoudl start digging amongst the journals now. > > My original thinking about my post was - if i have a nice easy 1st > order filter design algorithm - use it, square it, and then cascade it > if need be, instead of delving into advanced elliptic design. Maybe > its time too though. > > Best regards, > David > >
davidross wrote:
...
> I found even designing a second order butterworth filter from scratch > quite tricky, but maybe I'm looking at the wrong references. Probably I > shoudl start digging amongst the journals now.
No, don't. Filter design by analog prototypes is a "classical" design technique by now. The heyday was during the 60s, when lots of people knew how to design analog IIR filters, but before discrete-time techniques had been developed (it seems Ken Steiglitz was the central person around 1970). The relevant journal literature dates from the mid-late 60s, and is all but incomprehensable for the casual reader. Nowadays these techniques are so "well known" that only rudimentary accounts are included in textbooks on DSP. A few months ago, a book appeared http://www.amazon.com/gp/product/0071454241/qid=1143618441/sr=1-1/ref=sr_1_1/103-2220054-5955052?s=books&v=glance&n=283155 that apparently is an extension of a "classical" filter design. This book is the only book I know of, that reviews IIR filter design in a decent way. If you are interested in these kinds of things, get a copy. This type of material is not likely to be available in one book until this book is in its next edition, or in a Dover reprint.
> My original thinking about my post was - if i have a nice easy 1st order > filter design algorithm - use it, square it, and then cascade it if need > be, instead of delving into advanced elliptic design. Maybe its time too > though.
I suppose you can do things that way. The price to pay is that it takes a lot of fiddling around to get to a desired response, and the filter order becomes unnecessary high. It is very cumbersome to derive the design formulas for eliptic filters, but those filters are close to optimum what filter order is concerned. The elliptic filter gets the job done with a minimum of FLOPs. So it's a trade-off between who is to get the hard job: You, deriving the filter, or the computer crunching the numbers. Rune
davidross wrote:

>>> To go to 2nd Order multiply the numerator and denominator - >>> >>> % 1 + z^-1 (1 + z^-1)(1 + z^-1) >>> % H(z) = b ---------- = b -------------------- >>> % 1 - az^-1 (1 - az^-1)(1 - az^-1) >> >>> With this method, once I compute my coefficients I have to >>> scale them for the frequency response to be correct i.e. 0dB >>> at frequency 0. >> >>In case you chose b so that the first-order filter has unit DC >>gain, you need to square the whole thing instead of just the >>ratio of monic polynomials to keep that feature.
> Sounds like a good idea. I will include b this time and see what > happens. Maybe if I include b I wont have to scale? Is that what > you mean?
Exactly. Martin -- Quidquid latine scriptum sit, altum viditur.