From: Sam on 25 Nov 2009 21:09 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
From: Rune Allnor on 25 Nov 2009 21:53 On 26 Nov, 03:09, Sam <samke...(a)gmail.com> wrote: > For a high order filter, if I make Wn too small, I get an inexplicable > gain term on the resulting filter. You don't show all the commands for the design, but there are two possible reasons: 1) Numerical errors 2) Flawed design parameters Since you use matlab you work with double-precision floating point numbers, so one can at the outset disregard numerical errors, and look at the design parameters. In a good design algorithm, all you provide to the algorithm is the filter specification. Everything else is derived throughout the algorithm, so there is no reason for you to mess around with the internal variables to the design procedure. What you need to do, then, is to find out the commands needed to get from the spec to the filter coefficients. All the internal variables can be computed. Rune
From: The Phantom Piper on 26 Nov 2009 00:27 On Nov 26, 3:09 pm, Sam <samke...(a)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 Try multiplying the output by 0.00001
From: Sam on 26 Nov 2009 09:43 On Nov 25, 9:09 pm, Sam <samke...(a)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 Sorry, I forgot the order of the filter. If I set n = 24; The first filter gives me a gain of 100 dB, the 2nd gives me a gain of zero. I was under the impression all IIR filter designs should have a gain of 0 dB in the passband. Is that not the case? -Sam
From: Vladimir Vassilevsky on 26 Nov 2009 10:00 Sam wrote: > On Nov 25, 9:09 pm, Sam <samke...(a)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 > > > Sorry, I forgot the order of the filter. If I set > > n = 24; > > The first filter gives me a gain of 100 dB, the 2nd gives me a gain > of zero. I was under the impression all IIR filter designs should have > a gain of 0 dB in the passband. Is that not the case? Butterworth of the 24th order is ridiculous. You are very likely to run into numeric precision issues. "Matlab does all thinking for us" (TM) VLV
|
Next
|
Last
Pages: 1 2 3 Prev: DM642 EVM Emulator.....Urgent Help pls!!! Next: Assembly optimized error |