Rearrange sections in SOS filter




reorder(hs,order) rearranges the sections of filter hd using the vector of indices provided in order.

reorder(hs,numorder,denorder) reorders the numerator and denominator separately using the vectors of indices in numorder and denorder.

reorder(hs,numorder,denorder,svorder) specifies that the scale values can be independently reordered.

reorder(hs,filter_type) reorders hd in a way suitable for the specified filter type. This reordering mode can be especially helpful for fixed-point implementations where the order of the filter sections can significantly affect your filter performance.

reorder(hs,dir_flag) specifies rearranges the sections according to proximity to the origin of the poles of the sections.

reorder(hs,dir_flag,sv) reorders scale values in addition to rearranging sections according to pole-origin proximity.

reorder(hs,...) rearranges the sections of the filter System object™ hs according to any of the preceding input arguments.

reorder(hs,...,Name,Value) rearranges the sections of the filter System object hs with additional options specified by one or more Name,Value pair arguments.

Input Arguments

collapse all

dsp.BiquadFilter filter System object with one of the following filter structures:

df1sosDirect-form I filter object with second-order sections.
df1tsosDirect-Form I transposed filter with second-order sections.
df2sosDirect-form II filter object with second-order sections.
df2tsosDirect-Form II transposed filter with second-order sections.

Vector of indices used to reorder the filter sections. order does not need to contain all of the indices of the filter. Omitting one or more filter section indices removes the omitted sections from the filter. You can use a logical array to remove sections from the filter, but not to reorder it.

Vector of indices used to reorder the numerator. numorder and denorder must be the same length.

Vector of indices used to reorder the numerator. numorder and denorder must be the same length.

Independent reordering of scale values. When svorder is not specified, the scale values are reordered with the numerator. The output scale value always remains on the end when you use the argument numorder to reorder the scale values.

Filter type. The 'auto' option and automatic ordering only apply to filters that you used fdesign to create. With the 'auto' option as an input argument, reorder automatically rearranges the filter sections depending on the specification response type of the design.

Pole direction flag. When dir_flag is 'up', the first filter section contains the poles closest to the origin, and the last section contains the poles closest to the unit circle. When ir_flag is 'down', the sections are ordered in the opposite direction. reorder always pairs zeros with the poles closest to them.

Reorder scale values according to poles or zeros. By default the scale values are not reordered when you use the dir_flag input argument.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

For filter System object inputs only, specify the arithmetic used during analysis. When you specify 'double' or 'single', the function performs double- or single-precision analysis. When you specify 'fixed' , the arithmetic changes depending on the setting of the CoefficientDataType property and whether the System object is locked or unlocked.

 Details for Fixed-Point Arithmetic

When you do not specify the arithmetic, the function uses double-precision arithmetic if the filter System object is in an unlocked state. If the System object is locked, the function performs analysis based on the locked input data type.


collapse all

Being able to rearrange the order of the sections in a filter can be a powerful tool for controlling the filter process. This example uses reorder to change the sections of a df2sos filter. Let reorder do the reordering automatically in the first example. In the second, use reorder to specify the new order for the sections.

First use the automatic reordering option on a lowpass filter.

d = fdesign.lowpass('n,f3db',15,0.75);
biquad = design(d,'butter','SystemObject',true);
biquadreorder = reorder(biquad,'auto');

For another example of using reorder, create an SOS filter in the direct form II implementation.

biquad2sos = design(d,'butter', 'FilterStructure', 'df2sos',...
biquad2sosreorder = reorder(biquad2sos,[1 3:7 2 8]);
fvt = fvtool(biquad2sos,biquad2sosreorder,'analysis','coefficients');

Remove the third, fourth, and seventh sections.

biquad2sosclone1 = clone(biquad2sos);
reorder(biquad2sosclone1, logical([1 1 0 0 1 1 0 1]));
setfilter(fvt, biquad2sosclone1);

Move the first filter to the end, and remove the eighth section.

biquad2sosclone2 = clone(biquad2sos);
reorder(biquad2sosclone2, [2:7 1]);
setfilter(fvt, biquad2sosclone2);

Move the numerator and denominator independently.

biquad2sosclone3 = clone(biquad2sos);
reorder(biquad2sosclone3, [1 3:8 2], (1:8));
setfilter(fvt, biquad2sosclone3);


Schlichthärle, Dietrich, Digital Filters Basics and Design, Springer-Verlag Berlin Heidelberg, 2000.

See Also

| |

Introduced in R2011a