Documentation Center

  • Trial Software
  • Product Updates

reorder

Rearrange sections in SOS filter

Syntax

reorder(hd,order)
reorder(hd,numorder,denorder)
reorder(hd,numorder,denorder,svorder)
reorder(hd,filter_type)
reorder(hd,dir_flag)
reorder(hd,dir_flag,sv)
reorder(hs,...)
reorder(hs,...,Name,Value)

Description

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

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

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

reorder(hd,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(hd,dir_flag) specifies rearranges the sections according to proximity to the origin of the poles of the sections.

reorder(hd,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

hd

Discrete-time dfilt.df1sos, dfilt.df2tsos, dfilt.df2sos, or dfilt.df1tsosfilter object.

hs

dsp.BiquadFilter filter System object.

order

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.

numorder

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

denorder

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

svorder

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

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.

dir_flag

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.

sv

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 single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'Arithmetic'

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.

Examples

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);
hd = design(d,'butter');
hdreorder=reorder(hd,'auto');

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

[z,p,k] = butter(15,.5);
[sos, g] = zp2sos(z,p,k);
hd = dfilt.df2sos(sos,g);
reorder(hd, [1 3:7 2 8]);
hfvt = fvtool(hd, 'analysis', 'coefficients');

Reorder the sections by moving the second section to be between the seventh and eighth sections.

    reorder(hd, [1 3:7 2 8]);
    hfvt = fvtool(hd, 'analysis', 'coefficients');

Remove the third, fourth, and seventh sections.

    hd1 = copy(hd);
    reorder(hd1, logical([1 1 0 0 1 1 0 1]));
    setfilter(hfvt, hd1);

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

        hd2 = copy(hd);
    reorder(hd2, [2:7 1]);
    setfilter(hfvt, hd2);

Move the numerator and denominator independently.

    hd3 = copy(hd);
    reorder(hd3, [1 3:8 2], [1:8]);
    setfilter(hfvt, hd3);

References

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

See Also

| |

Was this topic helpful?