Reply by Rune Allnor April 1, 20062006-04-01
Al Clark wrote:
> I have an old addition of Antoniou. It > also has some of the IIR details you mention although maybe not the same > as the later addition.
I haven't seen the older versions, but the new one is the only DSP book I have seen (I have browsed DSP books regularly since around 1990) where the IIR design techniques are treated systematically. I don't know if those techniques are so "common" that everybody who was trained before 1990 take them for granted, but I searched for a long time to find all those details. The best I could come up with was the Van Valkenburg book from 1982 on analog filter design. It is so much easier to do these kinds of things when all the necessary material can be found in one place. Rune
Reply by davidross March 31, 20062006-03-31
Hi,

Thanks for the tips about the books. It looks like what I need as I'm
wanting to delve deeper into filter design and as I think you picked up
I'm currently not doing this as a job, and perhaps never will, but I 'do'
enjoy coding filters and do it really as a hobby just now. I really use it
to design real-time audio effects and like to use Matlab to design the
algorithms and plot the responses etc...

I'm aware I can use packages to design the coefficients directly, such as
Matlab. However, i need to have a filter which I can tweak the parameters
\ specifications in real-time. So for this reason alone I need to 'design
the whole filter from scratch'. Its definetly a good thing to learn about
books such as the one you mentioned! I have a text which i view as being
good by Sophociles Orfanidis but it doesnt concnetrate on just filter
design... so maybe I need a book which concentrates on just filter design
like the one mentioned. Hopefully my library will have a copy, luckily
they tend to be pretty good with there DSP books.

Its funny you mention designing your own filter design package. I recently
also made a Filter Design Web Service Application using C#. Probably not
all that useful but it was fun to make. Currently it supports 1st Order
IIR High and Low Pass, and 2nd Order IIR Peaking and Notch filters. Quite
rudimentary but its a start. Most of these filters I ported over from
Matlab, then to C++ where I use them for audio effects. I like the object
oriented approach where I can have a dedicated 'filter class'. Makes using
the filter a lot easier. However, I need to concentrate more now on the
actual filter design still so I can make the end filters better. Time to
get that book now!

Best Regards,
David
Reply by Al Clark March 31, 20062006-03-31
"Rune Allnor" <allnor@tele.ntnu.no> wrote in
news:1143795767.709380.327030@t31g2000cwb.googlegroups.com: 

> > Al Clark wrote: >> "Rune Allnor" <allnor@tele.ntnu.no> wrote in >> news:1143618776.758556.80540@z34g2000cwc.googlegroups.com: >> >> > >> > 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. >> >> I'm the last guy to say that you shouldn't read books or journals. I >> have 40-50 DSP books. > > Don't misunderstand me wrong... > > My response was based on my impression that the OP has a casual > interest in DSP. Reading books and journals is necessary if you take > classes or need in for your job, it may be a bit overwhelming if you > start > too early. As for IIR filter design, the Antoniou book seems to be the > only reasonably recent book that actually deals with this in a > systematical way. > >> However.... >> >> Most DSP guys use computer programs to generate coefficents and >> analyze filter responses. It's been a very long time since I >> calculated a filter by hand. > > Sure. A few months a go I implemented my own rudimentary filter design > program. While it is by no means as elaborate as some of the > professional > tools, it lets me do stuff I can't do with Matlab's Signal Processing > Toolbox. > As wellas let me explore some techniques of computer programming > I hadn't really tested before. > > I used the IIR filter design as a case study. While the main benefit > was > that I learned how to "really" do object oriented programming in C++, > I also discovered a few bells and whistles to fine-tune the filter > responses. > Assuming "perfect" maths, but still. > > Rune > >
There is really nothing better than a real project to learn something new. I got the same impression that OP has a casual interest. I think he really wants/needs a basic book. I have an old addition of Antoniou. It also has some of the IIR details you mention although maybe not the same as the later addition. I think what OP really wants/needs is a recipe. 1. Buy this or that filter program. 2. Implement the filter structure appropriate for his situation and target. 3. Move on to the next thing. -- Al Clark Danville Signal Processing, Inc. -------------------------------------------------------------------- Purveyors of Fine DSP Hardware and other Cool Stuff Available at http://www.danvillesignal.com
Reply by Rune Allnor March 31, 20062006-03-31
Al Clark wrote:
> "Rune Allnor" <allnor@tele.ntnu.no> wrote in > news:1143618776.758556.80540@z34g2000cwc.googlegroups.com: > > > > > 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. > > I'm the last guy to say that you shouldn't read books or journals. I have > 40-50 DSP books.
Don't misunderstand me wrong... My response was based on my impression that the OP has a casual interest in DSP. Reading books and journals is necessary if you take classes or need in for your job, it may be a bit overwhelming if you start too early. As for IIR filter design, the Antoniou book seems to be the only reasonably recent book that actually deals with this in a systematical way.
> However.... > > Most DSP guys use computer programs to generate coefficents and analyze > filter responses. It's been a very long time since I calculated a filter > by hand.
Sure. A few months a go I implemented my own rudimentary filter design program. While it is by no means as elaborate as some of the professional tools, it lets me do stuff I can't do with Matlab's Signal Processing Toolbox. As wellas let me explore some techniques of computer programming I hadn't really tested before. I used the IIR filter design as a case study. While the main benefit was that I learned how to "really" do object oriented programming in C++, I also discovered a few bells and whistles to fine-tune the filter responses. Assuming "perfect" maths, but still. Rune
Reply by Al Clark March 29, 20062006-03-29
"Rune Allnor" <allnor@tele.ntnu.no> wrote in
news:1143618776.758556.80540@z34g2000cwc.googlegroups.com: 

> > 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.
I'm the last guy to say that you shouldn't read books or journals. I have 40-50 DSP books. However.... Most DSP guys use computer programs to generate coefficents and analyze filter responses. It's been a very long time since I calculated a filter by hand. One of the features that many filter programs can do is set the precision of the coefficents and whether they are in floating or fixed point. This can be very useful when you are trying to look at performance of real filters with finite precision. Poles that might be close to the unit circle with perfect math, might even be outside the unit with finite precision math. I'm sure everyone has their favorite filter program. I like QEDesign 1000 (www.mds.com). I have used versions of QED since its original fortran implementation. One of the hidden benefits of QED design is that the programmer is an excellent DSP guy (Jerry Purcell). Jerry understands a lot of the subtleties to good filter design. I think they have a free demo program. Al Clark Danville Signal Processing, Inc. -------------------------------------------------------------------- Purveyors of Fine DSP Hardware and other Cool Stuff Available at http://www.danvillesignal.com
> > 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=s > r_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 >
--
Reply by Martin Eisenberg March 29, 20062006-03-29
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.
Reply by Rune Allnor March 29, 20062006-03-29
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
Reply by Al Clark March 28, 20062006-03-28
"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 > >
Reply by davidross March 28, 20062006-03-28
>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
Reply by davidross March 28, 20062006-03-28
>> 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