Reply by robert bristow-johnson September 9, 20032003-09-09
Erik de Castro Lopo <nospam@mega-nerd.com> wrote in message news:<3F5C408D.A4753D8F@mega-nerd.com>...
> 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?
yes. (for 4 or 5 biquads.) long ago i implemented some filtering on the MC68000 (wasn't real time but i wanted it done that day). that was 16 bit, didn't know all of the tricks i know now and it was pretty bad for more than 4th order. r b-j (remotely in North Dakota)
Reply by Bernhard Holzmayer September 9, 20032003-09-09
Erik de Castro Lopo wrote:

> Bernhard Holzmayer wrote: >> ... >> 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). >> ... > > Is that a high pass or low pass filter? > > Erik
Both. I started with this (for LPF): Fs = 48000; qz = quantizer('single',[32,8]); [b,a] = butter(4, fy / (Fs/2) ); [sos,g] = tf2sos(b,a); The result was poor. Applying a hint from Mathworks, I changed to: Fs = 48000; qz = quantizer('single',[32,8]); [z,p,k] = butter(4, fy / (Fs/2) ); [sos,g] = zp2sos(z,p,k); Results were ok, except at 1.5Hz. At 1.5Hz I shifted the frequency to fy=1.495Hz until I succeeded. Note: The internal stability method isstable() failed in my special situation and had to be replaced by a patched version from Mathworks. Bernhard -- before sending to the above email-address: replace deadspam.com by foerstergroup.de
Reply by Eric Backus September 8, 20032003-09-08
"Erik de Castro Lopo" <nospam@mega-nerd.com> wrote in message
news:3F5A70C7.50C784DE@mega-nerd.com...
> 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
It looks to me like a standard 10th-order elliptic filter can meet your specs, and actually have a stopband attenuation of over 104 dB. Alternatively, it could get exactly 100 dB attenuation and have a passband ripple of 0.035 dB. I assume that matlab could generate these, though I haven't tried it. An elliptic filter can be generated very quickly using standard techniques that don't require extensive search or iteration. Is there some other constraint or problem that makes a standard elliptical filter not work here? -- Eric Backus R&D Design Engineer Agilent Technologies, Inc. 425-356-6010 Tel
Reply by Erik de Castro Lopo September 8, 20032003-09-08
Al Clark wrote:
> > 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?
Not at the moment, but give any abritrary H(s) and a sample rate, it should be possible to turn that into a combined magnitude/phase response which can then be matched. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ "MS apparently now has a team dedicated to tracking problems with Linux and publicizing them. I guess eventually they'll figure out this back fires..." -- William Burrow
Reply by Erik de Castro Lopo September 8, 20032003-09-08
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
Reply by Al Clark September 8, 20032003-09-08
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
Reply by Erik de Castro Lopo September 8, 20032003-09-08
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.
Reply by Erik de Castro Lopo September 8, 20032003-09-08
"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
Reply by Bernhard Holzmayer September 8, 20032003-09-08
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
Reply by Peter J. Kootsookos September 7, 20032003-09-07
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