Biquad IIR filter design with Q factor sorting?

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?

 Respuesta aceptada

Paul
Paul el 21 de En. de 2026
Editada: Paul el 21 de En. de 2026
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 comentario

Jay
Jay el 21 de En. de 2026
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.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

Jay
el 21 de En. de 2026

Comentada:

Jay
el 21 de En. de 2026

Community Treasure Hunt

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

Start Hunting!

Translated by