Main Content

reorder

Reorder second-order sections of biquadratic filter System object

Description

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

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.

example

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.

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.

example

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 the reorder function to change the sections of a direct form II filter.

First use the automatic reordering option on a lowpass filter.

d = fdesign.lowpass('n,f3db',15,0.75);
sosFilt = design(d,'butter',SystemObject=true)
sosFilt = 
  dsp.SOSFilter with properties:

            Structure: 'Direct form II'
    CoefficientSource: 'Property'
            Numerator: [8x3 double]
          Denominator: [8x3 double]
       HasScaleValues: true
          ScaleValues: [0.7948 0.7005 0.6306 0.5794 0.5430 0.5186 0.5046 0.7071 1]

  Use get to show all properties

sosFiltreorder = reorder(sosFilt,'auto')
sosFiltreorder = 
  dsp.SOSFilter with properties:

            Structure: 'Direct form II'
    CoefficientSource: 'Property'
            Numerator: [8x3 double]
          Denominator: [8x3 double]
       HasScaleValues: true
          ScaleValues: [0.6306 0.5046 0.5430 0.7948 0.5794 0.7071 0.5186 0.7005 1]

  Use get to show all properties

Now, use reorder to specify the new order for the sections.

sosFiltspecifyreorder = reorder(sosFilt,[1 3:7 2 8]);
coeffs(sosFilt)
ans = struct with fields:
      Numerator: [8x3 double]
    Denominator: [8x3 double]
    ScaleValues: [9x1 double]

coeffs(sosFiltspecifyreorder)
ans = struct with fields:
      Numerator: [8x3 double]
    Denominator: [8x3 double]
    ScaleValues: [9x1 double]

Remove the third, fourth, and seventh sections.

sosFiltclone1 = clone(sosFilt);
reorder(sosFiltclone1,logical([1 1 0 0 1 1 0 1]));
coeffs(sosFiltclone1)
ans = struct with fields:
      Numerator: [5x3 double]
    Denominator: [5x3 double]
    ScaleValues: [6x1 double]

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

sosFiltclone2 = clone(sosFilt);
reorder(sosFiltclone2,[2:7 1]);
coeffs(sosFiltclone2)
ans = struct with fields:
      Numerator: [7x3 double]
    Denominator: [7x3 double]
    ScaleValues: [8x1 double]

Move the numerator and denominator independently.

sosFiltclone3 = clone(sosFilt);
reorder(sosFiltclone3,[1 3:8 2],(1:8));
coeffs(sosFiltclone3)
ans = struct with fields:
      Numerator: [8x3 double]
    Denominator: [8x3 double]
    ScaleValues: [9x1 double]

Input Arguments

collapse all

Biquadratic filter object, specified as a dsp.SOSFilter object.

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.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.

Version History

Introduced in R2011a

expand all

See Also

Functions

Objects