DSPRelated.com
Forums

LPF butterworth filter question

Started by Kai7918 May 12, 2010
Hey guys,

I have created a butter worth filter using SPTOOL in matlab.

the specifications are
•	Sampling frequency:		 1000Hz
•	Passband ripple:			 3dB
•	Stop band edge frequency:	 250Hz
•	Stopband attenuation:		 40dB
Pas band edge frequency:                 225Hz
Minimum order design
Single section

The filter is stable.

Here is a screen shot of the Magnitude response:
http://img43.imageshack.us/i/checkvt.jpg/

see how i have the thing @ about 350-400Hz. What is that. Is that unwanted
frequencies. If yes, then y do i get such thing.

Also 1 more question. What would the transition width be for this filter?

Thx



On 5/12/2010 8:42 AM, Kai7918 wrote:
> Hey guys, > > I have created a butter worth filter using SPTOOL in matlab. > > the specifications are > • Sampling frequency: 1000Hz > • Passband ripple: 3dB > • Stop band edge frequency: 250Hz > • Stopband attenuation: 40dB > Pas band edge frequency: 225Hz > Minimum order design > Single section > > The filter is stable. > > Here is a screen shot of the Magnitude response: > http://img43.imageshack.us/i/checkvt.jpg/ > > see how i have the thing @ about 350-400Hz. What is that. Is that unwanted > frequencies. If yes, then y do i get such thing.
What thing? I see a smooth curve down to the stop band. The stop-band attenuation shown is 350 dB, not 40. That represents a voltage ratio of 1/316227766016837933.2. I don't believe such numbers. It may be possible on paper, but hardly in practice. How would you measure it?
> Also 1 more question. What would the transition width be for this filter?
It depends on the definition for transition width that you apply. Fix the design before getting into that. Jerry -- "I view the progress of science as ... the slow erosion of the tendency to dichotomize." --Barbara Smuts, U. Mich. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
"Kai7918" <kai_the_ruler@n_o_s_p_a_m.yahoo.co.in> wrote in message 
news:v82dnS21gdCDP3fWnZ2dnUVZ_uSdnZ2d@giganews.com...
> Hey guys, > > I have created a butter worth filter using SPTOOL in matlab. > > the specifications are > &#4294967295;?&#4294967295; Sampling frequency: 1000Hz > &#4294967295;?&#4294967295; Passband ripple: 3dB > &#4294967295;?&#4294967295; Stop band edge frequency: 250Hz > &#4294967295;?&#4294967295; Stopband attenuation: 40dB > Pas band edge frequency: 225Hz > Minimum order design > Single section > > The filter is stable. > > Here is a screen shot of the Magnitude response: > http://img43.imageshack.us/i/checkvt.jpg/ > > see how i have the thing @ about 350-400Hz. What is that. Is that unwanted > frequencies. If yes, then y do i get such thing. > > Also 1 more question. What would the transition width be for this filter? > > Thx >
What do you mean "What would the transition width be"? May be I do not understand, but is'nt this just 25 Hz? You said so your specifications? (250-225)? btw, I do not understand those ripples you show in the stopband, there should not be such when using butterworth filter. I run your specs through a program I wrote for a class which designed an IIR low pass filter using butter, and I get order N=30 for this. The program implements impulse invariance or bilinear transformation. I used Bilinear method, and this is the result I copied from my screen: (I do not know what you mean by "single section" ) (I list the H(z) poles, the list shows each pole's real and imaginary value: if you are interested in reading my report on this program, here is the link http://12000.org/my_notes/IIR_digital_filter_design/index.htm note that my Mathematica program and my report is not yet completely polished and still in beta :) ***** S T A R T I N G F I L T E R D E S I G N ********* passband corner frequency (hz)=225 stop corner frequency (hz)=250 sampling frequency (hz)=1000 attenuation at passband corner (db) =-3 attenuation at stopband corner (db) =-40 Using Bilinear method Filter Order N=30 H(z) poles= {{0.14481876621354606, 0.9384373651677788}, {0.1319143750846099, 0.8454503212687019}, {0.12128495319828964, 0.7601980391715206}, {0.11247308374564964, 0.6813596047822589}, {0.10513579564319177, 0.607865551076532}, {0.09901260308329161, 0.5388376367669333}, {0.09390359551696477, 0.47354456664470596}, {0.08965414987894381, 0.4113688863686502}, {0.08614410199270338, 0.35178182199533364}, {0.08327998296589807, 0.29432383541544355}, {0.08098940518977824, 0.2385893292591055}, {0.07921698766919846, 0.18421437951083425}, {0.07792140930180781, 0.13086667592050333}, {0.07707331151574555, 0.07823705647504915}, {0.07665386283631981, 0.02603216276033525}, {0.07665386283631981, -0.02603216276033525}, {0.07707331151574555, -0.07823705647504915}, {0.07792140930180781, -0.13086667592050333}, {0.07921698766919846, -0.18421437951083425}, {0.08098940518977824, -0.2385893292591055}, {0.08327998296589807, -0.29432383541544355}, {0.08614410199270338, -0.35178182199533364}, {0.08965414987894381, -0.4113688863686502}, {0.09390359551696477, -0.47354456664470596}, {0.09901260308329161, -0.5388376367669333}, {0.10513579564319177, -0.607865551076532}, {0.11247308374564964, -0.6813596047822589}, {0.12128495319828964, -0.7601980391715206}, {0.1319143750846099, -0.8454503212687019}, {0.14481876621354606, -0.9384373651677788}},
On m=E1j. 12, 14:42, "Kai7918" <kai_the_ruler@n_o_s_p_a_m.yahoo.co.in>
wrote:
> Hey guys, > > I have created a butter worth filter using SPTOOL in matlab. > > the specifications are > =95 =A0 =A0 Sampling frequency: =A0 =A0 =A0 =A0 =A0 =A0 =A01000Hz > =95 =A0 =A0 Passband ripple: =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 3dB
> =95 =A0 =A0 Stop band edge frequency: =A0 =A0 =A0 =A0250Hz > =95 =A0 =A0 Stopband attenuation: =A0 =A0 =A0 =A0 =A0 =A040dB > Pas band edge frequency: =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 225Hz > Minimum order design > Single section > > The filter is stable. > > Here is a screen shot of the Magnitude response:http://img43.imageshack.u=
s/i/checkvt.jpg/
> > see how i have the thing @ about 350-400Hz. What is that. Is that unwante=
d
> frequencies. If yes, then y do i get such thing. > > Also 1 more question. What would the transition width be for this filter? > > Thx
If you're talking about the 'noise' in the response above 400 Hz, it appears to be some kind of finite precision effect during transfer function calculation. That is, the curve you see is not valid above 400 Hz because Matlab failed to calculate those (very small) numbers correctly. This seems to be an implementation issue of sptool. I've designed a filter with the same specification using fdatool, and it's correct (no noisy response below -350 dB). Anyway, this filter may be an overkill, depending on your application. Zsolt
On 17 Mai, 10:24, zs <zsolt.garamvol...@gmail.com> wrote:

> This seems to be an implementation issue of sptool.
No, it isn't. It's the quantization noise associated with double precision floating point numbers.
> I've designed a > filter with the same specification using fdatool, and it's correct (no > noisy response below -350 dB).
Are you sure? It might just as well be that the matlab's support team were so pissed off by incompetent users, who asked this very question, that they 'doctored' the spectrum display tool such that it shows a smooth curve. Find the coeffs of the filter and hack up your own spectrum display from raw matlab, *not* using any of the purpose-made tools that come with the toolboxes. Rune
On 5/18/2010 5:44 AM, Rune Allnor wrote:
> On 17 Mai, 10:24, zs<zsolt.garamvol...@gmail.com> wrote: > >> This seems to be an implementation issue of sptool. > > No, it isn't. It's the quantization noise associated with > double precision floating point numbers. > >> I've designed a >> filter with the same specification using fdatool, and it's correct (no >> noisy response below -350 dB). > > Are you sure? > > It might just as well be that the matlab's support team were so > pissed off by incompetent users, who asked this very question, > that they 'doctored' the spectrum display tool such that it > shows a smooth curve. > > Find the coeffs of the filter and hack up your own spectrum > display from raw matlab, *not* using any of the purpose-made > tools that come with the toolboxes.
It seems to me that the whole thing is a crock. How much numerical precision (to say nothing of physical isolation) would one need to get 350 dB suppression with an umpty-ump stage filter? The fuzz is arithmetic noise. (What does "single section" mean in the spec?) Jerry -- "I view the progress of science as ... the slow erosion of the tendency to dichotomize." --Barbara Smuts, U. Mich. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
On m&#4294967295;j. 18, 11:44, Rune Allnor <all...@tele.ntnu.no> wrote:
> On 17 Mai, 10:24, zs <zsolt.garamvol...@gmail.com> wrote: > > > This seems to be an implementation issue of sptool. > > No, it isn't. It's the quantization noise associated with > double precision floating point numbers. >
I intended to say that the filter response calculation is implemented with insufficient precision.
> > I've designed a > > filter with the same specification using fdatool, and it's correct (no > > noisy response below -350 dB). > > Are you sure? > > It might just as well be that the matlab's support team were so > pissed off by incompetent users, who asked this very question, > that they 'doctored' the spectrum display tool such that it > shows a smooth curve. >
This might be the case but doesn't sound very realistic to me. Matlab has support for variable precision arithmetic. If I were at Mathworks I would use that for correct response calculation instead of some 'symptomatic treatment'.
> Find the coeffs of the filter and hack up your own spectrum > display from raw matlab, *not* using any of the purpose-made > tools that come with the toolboxes. >
To further increase credibility, the response calculation could be tested by implementing it on a different platform (C/C++ or a custom digital circuit). However, the 1-bit information of deciding whether fdatool is correct under -350 dB does not sound very motivating to me.
> Rune
On 19 Mai, 08:25, zs <zsolt.garamvol...@gmail.com> wrote:
> On m&#4294967295;j. 18, 11:44, Rune Allnor <all...@tele.ntnu.no> wrote: > > > On 17 Mai, 10:24, zs <zsolt.garamvol...@gmail.com> wrote: > > > > This seems to be an implementation issue of sptool. > > > No, it isn't. It's the quantization noise associated with > > double precision floating point numbers. > > I intended to say that the filter response calculation is implemented > with insufficient precision.
Do you have the slightest idea what kind of dynamic range 350 dB represents?
> > > I've designed a > > > filter with the same specification using fdatool, and it's correct (no > > > noisy response below -350 dB). > > > Are you sure? > > > It might just as well be that the matlab's support team were so > > pissed off by incompetent users, who asked this very question, > > that they 'doctored' the spectrum display tool such that it > > shows a smooth curve. > > This might be the case but doesn't sound very realistic to me.
Incompetent users is a fact. Support teams being pissed off by incompetent users is a fact. Developers hiding trivial insignificants from incompetent users in order to ease the pressure on the support teams is a fact. Especially if the same people who develop the tools have to face the incompetent users for support.
> Matlab > has support for variable precision arithmetic. If I were at Mathworks > I would use that for correct response calculation instead of some > 'symptomatic treatment'.
You aren't at matlab. The comments you have made on the issue suggests that you are an incompetent user of matlab.
> > Find the coeffs of the filter and hack up your own spectrum > > display from raw matlab, *not* using any of the purpose-made > > tools that come with the toolboxes. > > To further increase credibility, the response calculation could be > tested by implementing it on a different platform (C/C++ or a custom > digital circuit). However, the 1-bit information of deciding whether > fdatool is correct under -350 dB does not sound very motivating to me.
Again, you seem not to have the slightest clue what you are talking about. Rune
On m&#4294967295;j. 19, 19:37, Rune Allnor <all...@tele.ntnu.no> wrote:
> On 19 Mai, 08:25, zs <zsolt.garamvol...@gmail.com> wrote: > > > On m&#4294967295;j. 18, 11:44, Rune Allnor <all...@tele.ntnu.no> wrote: > > > > On 17 Mai, 10:24, zs <zsolt.garamvol...@gmail.com> wrote: > > > > > This seems to be an implementation issue of sptool. > > > > No, it isn't. It's the quantization noise associated with > > > double precision floating point numbers. > > > I intended to say that the filter response calculation is implemented > > with insufficient precision. > > Do you have the slightest idea what kind of dynamic range 350 dB > represents? > > > > > I've designed a > > > > filter with the same specification using fdatool, and it's correct (no > > > > noisy response below -350 dB). > > > > Are you sure? > > > > It might just as well be that the matlab's support team were so > > > pissed off by incompetent users, who asked this very question, > > > that they 'doctored' the spectrum display tool such that it > > > shows a smooth curve. > > > This might be the case but doesn't sound very realistic to me. > > Incompetent users is a fact. Support teams being pissed off by > incompetent users is a fact. Developers hiding trivial insignificants > from incompetent users in order to ease the pressure on the > support teams is a fact. Especially if the same people who > develop the tools have to face the incompetent users for support. > > > Matlab > > has support for variable precision arithmetic. If I were at Mathworks > > I would use that for correct response calculation instead of some > > 'symptomatic treatment'. > > You aren't at matlab. The comments you have made on the issue > suggests > that you are an incompetent user of matlab. > > > > Find the coeffs of the filter and hack up your own spectrum > > > display from raw matlab, *not* using any of the purpose-made > > > tools that come with the toolboxes. > > > To further increase credibility, the response calculation could be > > tested by implementing it on a different platform (C/C++ or a custom > > digital circuit). However, the 1-bit information of deciding whether > > fdatool is correct under -350 dB does not sound very motivating to me. > > Again, you seem not to have the slightest clue what you > are talking about. > > Rune
I'm not talking about filter realization. From that viewpoint, I agree, that the response below, say, -100 dB is indifferent for most applications due to thermal noise, error of the ADCs, etc. Even if we wouldn't have this dynamic range limit stemming from the analog world, we still have finite word length effects, and why would someone need 350 dB suppression in the passband...and so on. What I'm talking about is filter design and visualization: when designing a filter, I think it's useful to see its actual response first, without taking 'secondary' effects into account. E.g, the (visualized) response being corrupted below -150 dB won't imply any problems during realization, but having a correct response in a larger dynamic range gives insight on the filter design process: the response shown by fdatool indicates that the filter is an analog Butterworth filter digitized using bilinear transform. Zsolt
> 350 dB suppression in the >>passband<<...and so on.
I mean, in the stopband, sorry.