Main Content

reorder

Reorder second-order sections of biquadratic filter System object

Description

reorder(sysobj,order) rearranges the sections of the biquadratic filter System object™ using the vector of indices provided in order.

example

sysobjnew = reorder(sysobj,order) generates a new biquadratic filter System object that contains the reordered sections. In this case, the original filter sysobj does not change.

reorder(sysobj,numorder,denorder) reorders the numerator and denominator of the filter separately using the vector of indices in numorder and denorder, respectively. These vectors must be of the same length.

reorder(sysobj,numorder,denorder,svorder) independently reorders the scale values of the biquadratic filter System object. If svorder is not specified, the scale values of the biquadratic filter are reordered in the same way as the numerator. The output scale value always remains at the end and numorder is used to reorder the scale values.

example

reorder(sysobj,filter_type) reorders sysobj in a way suitable for the specified filter type. This mode is intended for fixed-point implementations where the ordering of the sections can have a significant impact on the filter performance.

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

reorder(sysobj,dir_flag,sv) reorders the scale values following the reordering of the poles when sv is set to 'poles', or following the reordering of the zeros when sv is set to 'zeros'. The scale values are not reordered when using the dir_flag option unless sv is specified.

reorder(___,'Arithmetic',arithType) assumes that the filter arithmetic is equal to arithType.

Examples

collapse all

Being able to rearrange the order of the sections in a filter can be a powerful tool for controlling the filter design process. This example uses reorder to change the sections of a df2sos filter. Let reorder do the reordering automatically in the first filter. 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');

Then, create an SOS filter in the direct form II implementation.

biquad2sos = design(d,'butter', 'FilterStructure', 'df2sos',...
    'SystemObject',true);
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);

Input Arguments

collapse all

Biquadratic filter object, specified as either dsp.BiquadFilter or dsp.SOSFilter objects.

Vector of indices used to reorder the filter sections. order does not need to contain all 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.

When order is a vector of logicals, the function removes the sections of the filter that correspond to the index values where order is equal to false.

Data Types: double | logical

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

When numorder is a vector of logicals, the function removes the numerator coefficients that correspond to the index values where numorder is equal to false.

Data Types: double | logical

Vector of indices used to reorder the denominator of the filter. The numorder and denorder vectors must be of the same length.

When denorder is a vector of logicals, the function removes the denominator coefficients that correspond to the index values where denorder is equal to false.

Data Types: double | logical

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

When svorder is a vector of logicals, the function removes the scale values that correspond to the index values where svorder is equal to false.

Data Types: double | logical

Filter type. Automatic reordering only applies when sysobj was obtained using fdesign. With the 'auto' option as an input argument, reorder automatically rearranges the filter sections depending on the specification response type of the design (lowpass, highpass, etc).

Pole direction flag, specified as either:

  • 'up' –– The first filter section contains the poles closest to the origin, and the last section contains the poles closest to the unit circle.

  • 'down' –– The sections are ordered in the opposite direction. The zeros are always paired with the poles closest to them.

Scale value options, specified as either:

  • 'poles' –– Scale values are reordered following the reordering of the poles.

  • 'zeros' –– Scale values are reordered following the reordering of the zeros.

The scale values are not reordered when using the dir_flag option unless sv is specified.

Arithmetic type the reorder function assumes, specified as one of the following:

  • 'double' –– The function assumes a double precision filter when the arithmetic input is not specified and the filter System object is in an unlocked state.

  • 'single' –– The function assumes a single precision filter.

  • 'fixed' –– The overflow action used in the reorder operation is set to the action specified in the filter System object.

Output Arguments

collapse all

Biquadratic filter object with reordered second-order sections, returned as a dsp.BiquadFilter or a dsp.SOSFilter object. The SOS matrices and the corresponding scale values in the output object are as per the reorder arguments run on the input sysobj.

Introduced in R2011a