0
$\begingroup$

I'm relatively new to implementing IIR filters in raw programming formats (i.e. C or C++) and I've run into the concept of IIR filter realizations.

So my question: is there a 'best format (works 99% of the time)' for implementing these filters? i.e. an implementation that will typically be 'best' regardless of the application? Or is the actual implementation highly dependent on the application?

Here's an array of smaller yet related questions:

  • Is there ever an application in IIR filters where implementing the direct form of the filter is beneficial? Or should I always attempt to realize the filter as a cascade of subsystems?
  • Regarding cascade and parallel realizations, is cascaded always better?
  • Assuming that the exact filter implementation is dependent on the application, is it worth the effort to spend time and analyze the filter implementation from the beginning, or should I always aim for implementing as a cascaded subsystem and only deviate from that if the results are poor?
  • What is the purpose of transposed systems? I understand mathematically the differences, however, are there actual physical benefits of implementing a transposed vs nontransposed system?
$\endgroup$
  • 1
    $\begingroup$ can you tell us two things about your IIR filters? 1. are the characteristics if the filter expected to vary in time? is it time-invariant or not time-invariant? 2. what numerical format are you expecting to use for the states and the coefficients? floating or fixed point? what might be the word width? $\endgroup$ – robert bristow-johnson Aug 17 '16 at 16:36
  • 1
    $\begingroup$ why do you use the fir tag? $\endgroup$ – Marcus Müller Aug 17 '16 at 20:02
2
$\begingroup$

I don't think "regardless of application" works here. Every application has different requirements and hence the optimum choice would be different.

However in gross oversimplification

  1. Direct Form I is the "safest choice". Direct Form II is slightly better since it has only half the amount of state variables. Stay away from Direct Form II and Transposed Form I since the transfer functions to the state variables are only determined by the poles and there can be massive gain scaling issues
  2. Cascaded is the easiest choice. It's fairly simple to convert between poles and zeros and actual filter coefficients. Parallel requires calculating the roots of a large polynomial which is a numerically ill defined problem.
  3. There are different ways to pair poles and zeros to create second order sections. Best one is this : http://scipy.github.io/devdocs/generated/scipy.signal.zpk2sos.html
  4. Use floating point whenever possible. Fixed point IIR requires very careful analysis and application specific implementation.
  5. Whether optimization is worth it really depends on the application. Requirements can be all over the place: precision, speed, memory, mips, ease of us, stability against outlier condition, etc.
$\endgroup$
  • $\begingroup$ hey Hil, cascaded DF2 does not have "only half the amount of state variables" than DF1 except for the case of a single 2nd-order filter. and long, uncascaded Direct Forms are bad for a variety of numerical reasons. but if you have an $N$th-order, cascaded DF2, you have $N$ states (which makes it canonical), but an $N$th-order cascaded DF1 is $N+2$ states, not $2N$ states. and you're right, especially for fixed-point, a resonant DF2 is not better than a DF1. $\endgroup$ – robert bristow-johnson Aug 18 '16 at 1:49
1
$\begingroup$

I'll post this as an answer, simply because no matter what engineering you're doing:

i.e. an implementation that will typically be 'best' regardless of the application?

No. Something like this doesn't exist.

And it especially doesn't exist for filters, since their desired properties fully depend on the application you're designing for, and mostly are mutually contradicting:

  • Filter length vs attenuation
  • attenuation vs passband ripple
  • Filter length vs transition width
  • numerical stability vs steepness
  • Phase stability vs delay

So, every application defines requirements and objectives for a filter that demand for different parametrizations of different design methods.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.