Main Content

addStage

Add filter stage to cascade

Description

addStage(FC,newFilt) adds a filter stage represented by the newFilt System object™ as the final stage of the dsp.FilterCascade System object, FC. To see which System objects you can add to a filter cascade, use:

dsp.FilterCascade.helpSupportedSystemObjects

example

addStage(FC,newFilt,stageId) adds newFilt at stage position stageId of the filter cascade FC. All existing filters from stageId to the end of the cascade are shifted up in the cascade when newFilt is added.

example

Examples

collapse all

Call addStage with only the System object™ arguments,. The function adds the new filter stage as the final stage in the filter cascade.

FC = dsp.FilterCascade 
FC = 
  dsp.FilterCascade with properties:

         Stage1: [1x1 dsp.FIRFilter]
    CloneStages: true

addStage(FC,dsp.IIRFilter)
FC
FC = 
  dsp.FilterCascade with properties:

         Stage1: [1x1 dsp.FIRFilter]
         Stage2: [1x1 dsp.IIRFilter]
    CloneStages: true

Call addStage with an index argument. The function adds the new filter stage at the specified index. This example creates a filter cascade with three stages, and then adds a filter as the second stage of the cascade.

FC = dsp.FilterCascade(dsp.CICDecimator,dsp.FIRDecimator,dsp.FIRFilter)
FC = 
  dsp.FilterCascade with properties:

         Stage1: [1x1 dsp.CICDecimator]
         Stage2: [1x1 dsp.FIRDecimator]
         Stage3: [1x1 dsp.FIRFilter]
    CloneStages: true

addStage(FC,dsp.IIRFilter,2)
FC
FC = 
  dsp.FilterCascade with properties:

         Stage1: [1x1 dsp.CICDecimator]
         Stage2: [1x1 dsp.IIRFilter]
         Stage3: [1x1 dsp.FIRDecimator]
         Stage4: [1x1 dsp.FIRFilter]
    CloneStages: true

Input Arguments

collapse all

Filter cascade, specified as a dsp.FilterCascade System object.

Filter stage to add, specified as one of the supported System objects or a scalar gain value. Each stage can be a filter object or a scalar gain value. To see which System objects you can add to a filter cascade, use:

dsp.FilterCascade.helpSupportedSystemObjects

Index of filter stage to be added, specified as a positive integer. The object adds this stage to the filter cascade. All existing filters from stageId to the end of the cascade are shifted up in the cascade when the new filter is added.

Version History

Introduced in R2014b