IIR filters type 1 or 2 – what is best?

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Hello,

I’m making a dsp project at the moment. I was wondering what type of filter signal graph is the better one – regarding truncating the numbers in internal registers of the DSP processor.

The problem is that with the type 1 signal graph you can implement the difference equation in one go, keeping the numbers in the 32 bit register of the CPU right until the time they are sent to the DA converter.

This however I find hard to do with the type 2 signal graph, since it needs 2 difference equations to work.

My question is simply, witch signal graph is the better one for precision. Theoretically they describe the same system, but in real life there must be a superior type?

Thanks

\Jens
 
limit cycle oscilation

Hello,

I may have this up side down, but I understand limit cycle oscilation as the main factor that the IIR (infinite inpulse response) is called what it is. I belive it to be the noice generated by the algorithme thus making an oscillation because some of the truncation noise is feed back into the summoning point via the a1 and a2 coeffecients.

\Jens
 

Attachments

  • signalgraph.gif
    signalgraph.gif
    2.2 KB · Views: 166
Your first graph is correct, but the plot does not look too good! You are correct that the Infinite in IIR is because of feedback through a1 and a2, but not because of self-oscillation due to quantization noise. When a1,a2 and y is quantized this may raise the noisefloor, but should not create oscillation.

Are you using fixed or floating point? How many bits? What are your coefficients? If your a1 and a2 are very small, you might want to do the -a1*y(n-1)-a2*y(n-2) in double precision.
 
Hello,


I have not implemented the signal graph on a platfor yet. All the work so fars is done on a PC in a mathprogram.

I't a 6'th order system with high Q making a bandstop filter. The freq response is as planned, and it also stops the wanted freq when I sweep it. so it schould be ok i think.

\Jens
 
JensRasmussen said:
Hello,


I have not implemented the signal graph on a platfor yet. All the work so fars is done on a PC in a mathprogram.

I't a 6'th order system with high Q making a bandstop filter. The freq response is as planned, and it also stops the wanted freq when I sweep it. so it schould be ok i think.

\Jens


If you're using more than one Type I second order filter, you can use the denominator delays of one section as the numerator delays of the following section.


Francois.
 
If you use 32 bit registers and 16 bit input you should have no limit cycle oscillations!

Try aligning all data towards the MSB (keeping the headroom for the multiplications and additions) and do a right shift with round as the last thing you do. This might require more cycles and an analysis of the coeficcients of the filter.

Fun project, I have always been keen on knowing the sonic signatures of the digital filters used. There should be a lot of room for tweaking if you have control over the digital filters.

Do you have an estimate of the MIPS required and the headroom you have in the DSP?
 
Hello

I'm planning to make a number of wav files recorded with the music passing throu different filters. The plan is then to listen to the music in headphones to avoid speaker/room problems -evaluating the filter performance.

So I have no plans of making the filter run real time. I'll make the filter run in either matlab or mathcad

\Jens
 
JensRasmussen said:
Hello Francois,

I'm note sure that I understand, can you explain it a bit further please?

\Jens

- not a DSP geek yet, but hope to be :)


I was terse, sorry about that. Look at your filter structure. I assume you're building your sixth order filter, as any sane person would, out of cascaded second order filter sections, so you have three copies of your filter structure feeding each other in series, correct? Each filter has a left hand delay branch feeding forward into the summing node: I call these the numerator delays since their coefficients are the numerator polynomial of the digital filter equation. Similarly the right hand delay branch is the denominator delays since that's the denominator of the filter polynomial.

But wait! Look at the right hand delays for the first second order filter section. They contain the same delay values as the left hand delays for the second filter section. You can merge the two branches and have the shared delays feed back into the first section summing node and feed forward into the second section summing node. That simplifies your filter programming a lot for bigger filters, saving both space and more importantly DSP cycles.

I've got a crude picture drawn, but the post reply window has me wrestled to the ground.

Francois.
 
Hello,

Heeey now I see it.... sure this way you can save som registers for y(n-1) and y(n-2) in each second order filterblock....smart :)

I was going to just write the difference equations for one second order filter, and then copy it for the following sections. It can be done smarter - I can see now.

Thanks for the tip

\Jens
 
JensRasmussen said:
Hello,

Heeey now I see it.... sure this way you can save som registers for y(n-1) and y(n-2) in each second order filterblock....smart :)

I was going to just write the difference equations for one second order filter, and then copy it for the following sections. It can be done smarter - I can see now.

Thanks for the tip

\Jens


It's useful for real-time stuff, but if you're working in Mathcad you might as well repeat the filter equation - easier to debug. Hey, just because I like optimising under the right circumstances doesn't mean I'm not lazy at other times. I prefer to think of it as optimising my life, and since the sun is shining & the birds are singing I am outta here.


Good luck,
Francois.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.