[Dspforum] Matlab IIR filter outputs

Ryan Merton lucidsmog at gmail.com
Tue Nov 4 11:48:40 MST 2008


I suppose it's not quite exactly the same because you are likely
messing around with the quantization performance of the math involved
in the SOS.  Maybe I should go back and just let it do 11 sections
because MATLAB is, broadly speaking, smarter than I am.

Also, there is something wrong with the way I am calling
DSPF_sp_biquad I think.  Whenever that section of code is executed,
some key piece of memory is being overwritten (or something) because
the debugger totally freaks out and I have to reset everything.  I
pasted in the C equivalent code from the dsplib SPRU and it works
fine.

All of the pointers are double-word aligned.  I can't see any other
special things I would need to do to make the dsplib implementation
work.  Any ideas on that one?

I'm calling it like so:
//				DSPF_sp_biquad(tempFloat[curFloatIdx], b[x][y], a[x][y],
delay[x][y], tempFloat[newFloatIdx], BUFFERLEN);
				DSPF_sp_biquad_c(tempFloat[curFloatIdx], b[x][y], a[x][y],
delay[x][y], tempFloat[newFloatIdx], BUFFERLEN);

Where there are two float arrays that ping/pong input/output of each
SOS, x is the index for the IIR filter in u se, and y is the index
into the SOS for the filter.

Thanks,
Ryan

On Tue, Nov 4, 2008 at 7:57 AM, doug wenstrand <dougwen at gmail.com> wrote:
> Yea, that makes sense.  In fact, it was what I was trying to describe in
> class, but was so concerned about time that I'm sure I didn't do it
> adequately.
> What you normally see is 5 actual real biquads, and then some more stages :
> before the whole thing (+1) after the whole thing (+ 1) and between each IIR
> stage (+4).  That gives you a total of 11.  Those stages are written by
> MATLAB as biquads (so that you can do the computation easily) but as you
> point out, they aren't really much of anything.  When all the denom
> coefficients are set to 0, and the numerators are all (except the first one)
> what you have is just a gain stage : (output = b*input).  Matlab typically
> puts one of these at the front, and/or at the back.  The option is also
> there to scatter gain stages in the middle, but usually those are 1.
> So yes, feel free to not implement those gain stages as actual biquads,
> after all, it is just a single multiply.  You can also get some mileage out
> of your suggestion of just folding the gain into the first stage by applying
> it to the exported coefficients.   This isn't _exactly_ the same though
> right?
>
> On Mon, Nov 3, 2008 at 5:32 PM, Ryan Merton <lucidsmog at gmail.com> wrote:
>>
>> Hi,
>>
>> So if I design an IIR filter with FDATool, set it to single-precision
>> float quantization, and output the coefficients at SOS, I end with
>> with something curious:
>>
>> If I have a 10th order filter, I have 5 SOS.  But what I end up with
>> are 11 sections.  It appears as though some of the section are just
>> constants though.  I think their only purpose is to apply gain.  I
>> think I can just multiply the gain into the numerator coefficients and
>> be left with 5 sets of numerator/denominator coefficients.
>>
>> Does that make sense?
>>
>> Thanks,
>> Ryan
>>
>> _______________________________________________
>> Dspforum mailing list
>> Dspforum at echelonembedded.com
>> http://echelonembedded.com/mailman/listinfo/dspforum_echelonembedded.com
>
>
> _______________________________________________
> Dspforum mailing list
> Dspforum at echelonembedded.com
> http://echelonembedded.com/mailman/listinfo/dspforum_echelonembedded.com
>
>



More information about the Dspforum mailing list