Biquad IIR filter design with Q factor sorting?

27 views (last 30 days)
Jay
Jay on 21 Jan 2026 at 18:52
Commented: Jay on 21 Jan 2026 at 23:10
I have designed biquad IIR filter:
h = fdesign.lowpass('N,Fc', 8, 10e3, 100e3); % 4-biquad with 100kHz sampling rate and 10kHz cutoff freq
Hd = design(h, 'butter');
Warning: The 'butter' design method is obsolete. Using 'butter' with Fc specification sets still works but will be removed in the future. Use a specification with F3dB instead.
Hd_sos = convert(Hd, 'df2sos');
Hd_sos =
FilterStructure: 'Direct-Form II, Second-Order Sections' Arithmetic: 'double' sosMatrix: [4x6 double] ScaleValues: [0.085667864748513;0.0719845250125051;0.0641431197006179;0.0605721791831837;1] OptimizeScaleValues: true PersistentMemory: false
I checked Q-factor and realized the first sos section has the largest Q and the last sos has the smallest. I want the smallest Q to be first and the lagest to be the last sos. Any suggestion to do so?

Accepted Answer

Paul
Paul on 21 Jan 2026 at 22:29
Edited: Paul on 21 Jan 2026 at 22:31
Hi Jay,
h = fdesign.lowpass('N,Fc', 8, 10e3, 100e3); % 4-biquad with 100kHz sampling rate and 10kHz cutoff freq
Hd = design(h, 'butter');
Warning: The 'butter' design method is obsolete. Using 'butter' with Fc specification sets still works but will be removed in the future. Use a specification with F3dB instead.
Hd is already in DF2SOS form
Hd.FilterStructure
ans = 'Direct-Form II, Second-Order Sections'
so the call to convert seems to be redundant (unless it does something else that I'm missing.
Hd_sos = convert(Hd, 'df2sos');
Hd_sos.FilterStructure
ans = 'Direct-Form II, Second-Order Sections'
We see that
[isequal(Hd.ScaleValues,Hd_sos.ScaleValues), isequal(Hd.sosMatrix,Hd_sos.sosMatrix)]
ans = 1×2 logical array
1 1
To reorder the sections, the function reorder offers several options.
  1 Comment
Jay
Jay on 21 Jan 2026 at 23:10
Thanks Paul for the quick reply!
You are right Hd is already in df2sos. The function reorder was exactly what I've been looking for.

Sign in to comment.

More Answers (0)

Categories

Find more on Digital and Analog Filters in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!