I have designed a bandpass IIR butterworth filter with desired response using the MATLAB FDAtool with the configuration shown in the figure below

enter image description here

Since this is multistage implementation, when I export the filter object to workspace I don't get numerator and denominator of transfer function as filter parameters and instead I get sos matrix and scale values as shown below

FilterStructure: 'Direct-Form II, Second-Order Sections' Arithmetic: 'double'
sosMatrix: [12x6 double]
ScaleValues: [13x1 double]
OptimizeScaleValues: true
PersistentMemory: false

The problem is I have to port this design to C code for implementation in firmware and the multi-order specification looks complicated to define an input-output expression. So I tried converting this design into a single stage filter(using convert to single section option under edit), but the following is magnitude response that what I get.

enter image description here

Not only is the response way-off, but the system is unstable.

My questions are the following,

1) Why is FDAtool not able to produce a good single stage equivalent filter?

2) How to calculate groupdelay of the multi-stage filter?

3) Is the groupdelay of the multistage filter simply FilterOrder*Sample time as in a direct form FIR or is it more complicated for IIR and multistage filters?

4) Will the groupdelay of multi-stage filter be the same as a possible acceptable(in terms of magnitude response) single stage equivalent?

5) How important is stability of the filter?

6) Does FDAtool have an option to visualize the filter structure?(Edit>Show Filter Structure doesn't seem to work)

7) What is the tradeoff between Filter Order and Number of sections in the filter other than structural complexity?


Large order single stage filters are inherently problematic. Calculating the numerators and denominator from the poles and zeros is an ill defined problem and numerically unstable. Furthermore Direct Form II is the worst possible filter topology. I strongly recommend Direct Form I or transposed Form II.

To the questions:

  1. Numerically ill defined problem
  2. Just add the group delay of the indivdiual stages
  3. Group delay is always defined as the negative first derivative of the phase of the transfer function vs. frequency. That's the same for FIR and IIR. It's frequency dependent.
  4. Yes. If you had infinite precision math, the results would be the same.
  5. Very important. You can't implement and unstable filter, you'd only get noise NaN or infinity as output
  6. No idea
  7. Pretty much everyone implements filter ins biquad sections. So the number of stages and the filter order is directly proportional

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.