Main Content

addBranch

Add new filter branch to parallel filter

Since R2023b

Description

addBranch(PF,newBranch) adds a new filter branch at the end of the stack of the parallel filter PF. The new branch can be a filter System object™ or a scalar value. To see a list of filter objects that you can add as branches to the parallel filter stack, run this command in the MATLAB® command prompt.

dsp.ParallelFilter.helpSupportedSystemObjects

addBranch(PF,newBranch,branchId) adds the branch newBranch at the branch position branchId of the parallel filter PF. All existing branches from branchId to the end of the filter stack shift down in the stack when you add the new branch.

example

Examples

collapse all

Use the addBranch function to add new branches to an existing parallel filter.

Add at End of Parallel Filter

Construct a dsp.ParallelFilter object with dsp.CICDecimator as its first branch.

pf = dsp.ParallelFilter(dsp.CICDecimator)
pf = 
  dsp.ParallelFilter with properties:

          Branch1: [1x1 dsp.CICDecimator]
    CloneBranches: true

Add a dsp.FIRDecimator branch at the end of the parallel filter.

addBranch(pf,dsp.FIRDecimator);
pf
pf = 
  dsp.ParallelFilter with properties:

          Branch1: [1x1 dsp.CICDecimator]
          Branch2: [1x1 dsp.FIRDecimator]
    CloneBranches: true

Add at Specific Index

You can also specify the index at which to add a new branch.

Add dsp.FarrowRateConverter as the second branch. The dsp.FIRDecimator object at index 2 shifts to index 3.

addBranch(pf,dsp.FarrowRateConverter(48,24),2);
pf
pf = 
  dsp.ParallelFilter with properties:

          Branch1: [1x1 dsp.CICDecimator]
          Branch2: [1x1 dsp.FarrowRateConverter]
          Branch3: [1x1 dsp.FIRDecimator]
    CloneBranches: true

Input Arguments

collapse all

Parallel filter, specified as a dsp.ParallelFilter System object.

Filter branch to add, specified as a filter System object or scalar gain value. To see which System objects you can add as filter branches, run this command in the MATLAB command prompt:

dsp.ParallelFilter.helpSupportedSystemObjects

Index of the filter branch to add, specified as a positive integer. The function adds a filter branch at this location in the parallel filter. All existing branches from branchId to the end of the filter stack shift down in the stack when you add the new branch.

Version History

Introduced in R2023b