DSPRelated.com
Forums

Mysterious gain when designing a butterworth filter in MATLAB

Started by Sam November 25, 2009
On Wed, 25 Nov 2009 18:09:08 -0800 (PST), Sam <samkeene@gmail.com>
wrote:

>For a high order filter, if I make Wn too small, I get an inexplicable >gain term on the resulting filter. I am trying to use zpk form and >then go to second orders sections. It works, but only sometimes. >Here's an example: > >% This gives me a filter of gain 100 dB and I have no idea why? >[z,p,k] = butter(n,.1); >[sos,g] = zp2sos(z,p,k); >Hd1 = dfilt.df2sos(sos,g); >fvtool(Hd1) > >% But this gives me a gain of 0 dB, as expected >[z,p,k] = butter(n,.2); >[sos,g] = zp2sos(z,p,k); >Hd2 = dfilt.df2sos(sos,g); >fvtool(Hd2) > > >Does anyone know the reason for this? > >thanks, > >-Sam
High order butterworth filters with very high/low cut-off frequencies are difficult to design so you're probably hitting a bug in FDA in Matlab. File a bug with them. -- Muzaffer Kal DSPIA INC. ASIC/FPGA Design Services http://www.dspia.com
On 27 Nov, 02:24, Sam <samke...@gmail.com> wrote:
> On Nov 26, 7:46=A0pm, Rune Allnor <all...@tele.ntnu.no> wrote: > > > On 27 Nov, 00:16, Sam <samke...@gmail.com> wrote: > > > > Why can FDATOOL do it if I can't? > > > Because whoever implemented FDATOOL took the time to > > read up on, contemplate and investigate the principles, > > algorithms and procedures used in filter design. > > > Rune > > So you mean to tell me that if I design a filter with exactly the same > specifications in FDATOOL as at the command line, I should simply > accept that they give different results for no apparent reason?
Not for no apparent reason. Because their results are correct.
> Because the people who wrote FDATOOL are so much more enlightened than > I?
Well, yes. They are. They managed to come up with a working design provedure.
> The two filters have exactly the same frequency shape, however one has > a large gain and the other does not. I would like to understand why, > if you cannot help me to do so, you need not be rude.
There is nothing rude about pointing out that you obviously have no idea about what you are doing. The 'mysterious' gain you see is there because you do not use the correct design algorithm, but are merely messing around with functions you do not understand how work, the arguments they require, results they produce, nor how to use these results. Rune