Main Content

removeStage

Remove stage from filter cascade

Description

removeStage(FC) removes the final stage of the dsp.FilterCascade System object™ FC.

example

removeStage(FC,stageId) removes the stage from stage position stageId of the filter cascade FC. All existing filter stages from stageId to the end of the cascade are shifted down in the cascade when the stage is removed.

Examples

collapse all

Call removeStage with no arguments other than the filter cascade System object™. The function removes the last stage in the filter cascade.

FC2= dsp.FilterCascade(dsp.FIRFilter,...
    dsp.IIRFilter)
FC2 = 
  dsp.FilterCascade with properties:

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

removeStage(FC2);
FC2
FC2 = 
  dsp.FilterCascade with properties:

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

To remove a specific stage of the cascade, specify the index for that stage as an input argument. This example creates a filter cascade that has four stages, and then removes the third stage.

 FC4 = cascade(dsp.FIRInterpolator,...
     dsp.FIRInterpolator,...
     dsp.FIRDecimator,...
     dsp.FIRDecimator)
FC4 = 
  dsp.FilterCascade with properties:

         Stage1: [1x1 dsp.FIRInterpolator]
         Stage2: [1x1 dsp.FIRInterpolator]
         Stage3: [1x1 dsp.FIRDecimator]
         Stage4: [1x1 dsp.FIRDecimator]
    CloneStages: true

 removeStage(FC4,3);
 FC4
FC4 = 
  dsp.FilterCascade with properties:

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

Input Arguments

collapse all

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

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

Version History

Introduced in R2014b