Forums

IIR filter design

Started by Erik de Castro Lopo September 5, 2003
Hi all,

As we all know, designing IIR filters is easy enough 
for low filter order but is far more difficult when 
higher order filters are required to meet design 
contraints like low passband ripple, narrow transition 
bands and high levels of attenuation in the stopband.

I'm currently working on a program for designing IIR 
filters and this software has recently produced a LP 
filter with the following specs:

     Order    : 18
     Passband : 0 - 0.2*fs   < 0.1 dB ripple
     Stopband : 0.25*fs - 0.5*fs  > 100 dB attenuation

This was achieved with a single overnight run on a 
450Mhz Pentium III machine. I am now trying to design 
a 16th order filter to meet the same specs.

I'm therefore asking people here the following questions:

   0) How big and how "difficult" are the IIR filters you
      have designed?
   1) What methods and/or software was used to design 
      them?

TIA,
Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  nospam@mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
A sufficiently advanced programming error is
indistinguishable from the Windows 95 Operating System.
Erik de Castro Lopo wrote:
> > Hi all, > > As we all know, designing IIR filters is easy enough > for low filter order but is far more difficult when > higher order filters are required to meet design > contraints like low passband ripple, narrow transition > bands and high levels of attenuation in the stopband. > > I'm currently working on a program for designing IIR > filters and this software has recently produced a LP > filter with the following specs: > > Order : 18 > Passband : 0 - 0.2*fs < 0.1 dB ripple > Stopband : 0.25*fs - 0.5*fs > 100 dB attenuation
Another run of this program (4.5hrs) produced a 13th order filter meeting the same specs. Obviously, some more work is needed to find the minimum order for a given design spec. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ From Time magazine, "Numbers" section: $5 million: Estimated annual cost for a 10-year program that would identify large asteroids most threatening to earth. $75 million: Budget for "Deep Impact", a film about the devastation caused when a comet hits earth.
Hi Erik

What is so special about these IIR filters. It seems to me like
you're software takes a very long time to run. I have used 
filter design software packages like ONEoverT and QEDesign
and they will generate IIR filters of this order immediately.

Please enlighten me about the particular filters you are designing
and why it takes so long to produce them.

Thanks
Bob 


Erik de Castro Lopo <nospam@mega-nerd.com> wrote in message news:<3F592C33.DD349F59@mega-nerd.com>...
> Hi all, > > As we all know, designing IIR filters is easy enough > for low filter order but is far more difficult when > higher order filters are required to meet design > contraints like low passband ripple, narrow transition > bands and high levels of attenuation in the stopband. > > I'm currently working on a program for designing IIR > filters and this software has recently produced a LP > filter with the following specs: > > Order : 18 > Passband : 0 - 0.2*fs < 0.1 dB ripple > Stopband : 0.25*fs - 0.5*fs > 100 dB attenuation > > This was achieved with a single overnight run on a > 450Mhz Pentium III machine. I am now trying to design > a 16th order filter to meet the same specs. > > I'm therefore asking people here the following questions: > > 0) How big and how "difficult" are the IIR filters you > have designed? > 1) What methods and/or software was used to design > them? > > TIA, > Erik
Erik de Castro Lopo <nospam@mega-nerd.com> wrote in message news:<3F592C33.DD349F59@mega-nerd.com>...
...
> I'm therefore asking people here the following questions: > > 0) How big and how "difficult" are the IIR filters you > have designed?
i have chained together maybe 4 or 5 biquads in cascade. the noise starts to get to be a little bad by then.
> 1) What methods and/or software was used to design > them?
only used analog prototypes with BLT. never an "optimized" (prony) method. i'm pretty much a luddite. r b-j
Erik de Castro Lopo <nospam@mega-nerd.com> writes:

> As we all know, designing IIR filters is easy enough > for low filter order but is far more difficult when > higher order filters are required to meet design > contraints like low passband ripple, narrow transition > bands and high levels of attenuation in the stopband. > > I'm currently working on a program for designing IIR > filters and this software has recently produced a LP > filter with the following specs: > > Order : 18 > Passband : 0 - 0.2*fs < 0.1 dB ripple > Stopband : 0.25*fs - 0.5*fs > 100 dB attenuation > > This was achieved with a single overnight run on a > 450Mhz Pentium III machine. I am now trying to design > a 16th order filter to meet the same specs. > > I'm therefore asking people here the following questions: > > 0) How big and how "difficult" are the IIR filters you > have designed? > 1) What methods and/or software was used to design > them?
Erik, Matlab's cheby2 technique gives a direct answer that appears to satisfy your constraints. Your program should certainly NOT be taking hours to calculate it! Ciao, Peter K.
>> [B,A] = cheby2(18, 100, 0.5)
B = Columns 1 through 4 0.00167583914216 0.01249479541868 0.05282702120282 0.15939804265706 Columns 5 through 8 0.37690207631117 0.73227013789108 1.20191856962356 1.69522872823393 Columns 9 through 12 2.07598674519837 2.21972389625291 2.07598674519838 1.69522872823395 Columns 13 through 16 1.20191856962359 0.73227013789110 0.37690207631118 0.15939804265707 Columns 17 through 19 0.05282702120282 0.01249479541868 0.00167583914216 A = Columns 1 through 4 1.00000000000000 -0.27631970006174 3.19751214254060 -0.15685969461355 Columns 5 through 8 4.13926117356269 0.60689917820044 2.95082770636540 0.89016501910416 Columns 9 through 12 1.32135245849798 0.51502467236824 0.38906643866660 0.15367372690642 Columns 13 through 16 0.07255803834919 0.02422454070134 0.00756108751837 0.00179848550988 Columns 17 through 19 0.00033713574499 0.00004258794833 0.00000281030149 -- Peter J. Kootsookos "Na, na na na na na na, na na na na" - 'Hey Jude', Lennon/McCartney
Peter J. Kootsookos wrote:

> Erik de Castro Lopo <nospam@mega-nerd.com> writes: > >> As we all know, designing IIR filters is easy enough >> for low filter order but is far more difficult when >> higher order filters are required to meet design >> contraints like low passband ripple, narrow transition >> bands and high levels of attenuation in the stopband. >> >> I'm currently working on a program for designing IIR >> filters and this software has recently produced a LP >> filter with the following specs: >> >> Order : 18 >> Passband : 0 - 0.2*fs < 0.1 dB ripple >> Stopband : 0.25*fs - 0.5*fs > 100 dB attenuation >> >> This was achieved with a single overnight run on a >> 450Mhz Pentium III machine. I am now trying to design >> a 16th order filter to meet the same specs. >> >> I'm therefore asking people here the following questions: >> >> 0) How big and how "difficult" are the IIR filters you >> have designed? >> 1) What methods and/or software was used to design >> them? > > Erik, > > Matlab's cheby2 technique gives a direct answer that appears to > satisfy your constraints. > > Your program should certainly NOT be taking hours to calculate it! > > Ciao, > > Peter K. > >>> [B,A] = cheby2(18, 100, 0.5) > ...
Hi Peter (and Erik), Matlab caused a lot of pain when I tried to design even lower order filters (4th order Butterworth), when the relation between cutoff-frequency and sampling frequency decreases: try this: 4th order HPF and LPF (independently) at 1.5Hz (Fs=48kHz). I agree, that the calculation is very quick (Matlab 6.5), but if you work with this filter, you'll find that it tends to be instable. In fact, Matlab wasn't able to calculate a stable set of coefficients, although I used the superior approach which doesn't use [b,a] = ... , but with state space equations. Supported by the development team of Mathworks we found the optimum solution for most of the cutoff-frequencies I needed, but this certain one could only be solved by changing the frequency to 1.495Hz. Reason behind: internal calculations which search for iterative results (roots, poly()-function), stop iteration too quickly - obviously a tradeoff to improve the speed of the calculations. I don't blame Matlab for it, because they find a compromise which satisfies most of the users - and probably most want quick results. But there's no option for maximum precision which I would have taken, even if it would have worked a whole night. So it might be possible that Eriks program isn't to be blamed for a long calculation time - but I would require a solution for the above filters and for all butterworth filters of 4th order and downto 0.25Hz @ 48kS/s. If it can provide this, it's superior to Matlab in this area. Note: I work with 32bit floating point filter processing, coefficients might even be 40bit, if necessary, but to my opinion 32bit should be enough. However, internal calculation during coefficient calculation might require at least 64bit power. Note: The described filters are not just for engineer's satisfaction. I really intend to use them for a product we sell. Bernhard -- before sending to the above email-address: replace deadspam.com by foerstergroup.de
"Peter J. Kootsookos" wrote:
> > Erik, > > Matlab's cheby2 technique gives a direct answer that appears to > satisfy your constraints. > > Your program should certainly NOT be taking hours to calculate it!
Hi Peter, Thanks for the reality check :-). Maybe the example I gave was not a good one because a direct result was so readily available. The software I'm working on is intended to find filters other than standard low/high/band pass. In particular, it should find filters which meet arbitrary magnitude response requirements, possibly with simultaneous phase response requirements as well as finding solutions where the more traditional methods produced filters with instability problems in particular implementations (as Bernhard Holzmayer was suggesting). More importantly, it should recognise when a specification can be easily met using more standard methods :-). Cheers, Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ "It's far too easy to make fun of Microsoft products, but it takes a real man to make them work, and a god to make them do anything useful" -- Anonymous
robert bristow-johnson wrote:
> > Erik de Castro Lopo <nospam@mega-nerd.com> wrote in message news:<3F592C33.DD349F59@mega-nerd.com>... > ... > > I'm therefore asking people here the following questions: > > > > 0) How big and how "difficult" are the IIR filters you > > have designed? > > i have chained together maybe 4 or 5 biquads in cascade. the noise > starts to get to be a little bad by then.
Hi Robert, Since its you saying this, i have to resume that you are talking about implementations using 24 bit fixed point arithmetic :-). Correct? Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ Q: How do you stop a Windows NT machine from crashing? A: Shut it down and switch it off.
Erik de Castro Lopo <nospam@mega-nerd.com> wrote in 
news:3F5C4040.9FDD1568@mega-nerd.com:

> "Peter J. Kootsookos" wrote: >> >> Erik, >> >> Matlab's cheby2 technique gives a direct answer that appears to >> satisfy your constraints. >> >> Your program should certainly NOT be taking hours to calculate it! > > Hi Peter, > > Thanks for the reality check :-). > > Maybe the example I gave was not a good one because a direct > result was so readily available. > > The software I'm working on is intended to find filters other > than standard low/high/band pass. In particular, it should find > filters which meet arbitrary magnitude response requirements, > possibly with simultaneous phase response requirements as well > as finding solutions where the more traditional methods produced > filters with instability problems in particular implementations > (as Bernhard Holzmayer was suggesting). > > More importantly, it should recognise when a specification can > be easily met using more standard methods :-). > > Cheers, > Erik
Erik, I don't have any suggestions but I am very interested in a filter program that does a good job at matching arbitrary responses. One of the filters that comes to mind is the standard A Weighting filter. It is defined (by standard) in the s plane and therefore does not map perfectly into the z plane. Can your program accept a function written as H(s) as a target? Al Clark Danville Signal Processing, Inc. -------------------------------------------------------------------- Purveyors of Fine DSP Hardware and other Cool Stuff Available at http://www.danvillesignal.com
Bernhard Holzmayer wrote:
> > Peter J. Kootsookos wrote: > > > Erik de Castro Lopo <nospam@mega-nerd.com> writes: > > > >> As we all know, designing IIR filters is easy enough > >> for low filter order but is far more difficult when > >> higher order filters are required to meet design > >> contraints like low passband ripple, narrow transition > >> bands and high levels of attenuation in the stopband. > >> > >> I'm currently working on a program for designing IIR > >> filters and this software has recently produced a LP > >> filter with the following specs: > >> > >> Order : 18 > >> Passband : 0 - 0.2*fs < 0.1 dB ripple > >> Stopband : 0.25*fs - 0.5*fs > 100 dB attenuation > >> > >> This was achieved with a single overnight run on a > >> 450Mhz Pentium III machine. I am now trying to design > >> a 16th order filter to meet the same specs. > >> > >> I'm therefore asking people here the following questions: > >> > >> 0) How big and how "difficult" are the IIR filters you > >> have designed? > >> 1) What methods and/or software was used to design > >> them? > > > > Erik, > > > > Matlab's cheby2 technique gives a direct answer that appears to > > satisfy your constraints. > > > > Your program should certainly NOT be taking hours to calculate it! > > > > Ciao, > > > > Peter K. > > > >>> [B,A] = cheby2(18, 100, 0.5) > > ... > > Hi Peter (and Erik), > > Matlab caused a lot of pain when I tried to design even lower order > filters (4th order Butterworth), when the relation between > cutoff-frequency and sampling frequency decreases: > try this: 4th order HPF and LPF (independently) at 1.5Hz (Fs=48kHz). > > I agree, that the calculation is very quick (Matlab 6.5), but if you > work with this filter, you'll find that it tends to be instable. > In fact, Matlab wasn't able to calculate a stable set of > coefficients, although I used the superior approach which doesn't > use [b,a] = ... , but with state space equations. > > Supported by the development team of Mathworks we found the optimum > solution for most of the cutoff-frequencies I needed, but this > certain one could only be solved by changing the frequency to > 1.495Hz. > > Reason behind: internal calculations which search for iterative > results (roots, poly()-function), stop iteration too quickly - > obviously a tradeoff to improve the speed of the calculations. > > I don't blame Matlab for it, because they find a compromise which > satisfies most of the users - and probably most want quick results. > But there's no option for maximum precision which I would have > taken, even if it would have worked a whole night. > > So it might be possible that Eriks program isn't to be blamed for a > long calculation time - but I would require a solution for the > above filters and for all butterworth filters of 4th order and > downto 0.25Hz @ 48kS/s.
Is that a high pass or low pass filter? Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ "The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners." -- Ernst Jan Plugge