parallel
Create parallel sum filter structure
Description
returns an object PF = parallel(branch1,branch2,...,branchn)PF of type dsp.ParallelFilter. PF is a parallel
structure of the filter branches branch1, branch2, ..., branchn.
Each individual branch can be a filter System object™ or a scalar gain value, but at least one branch must be a filter
object.
The input filter objects must be supported by the parallel
function. 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
specifies the input sample rate of the parallel filter as one of these options:PF = parallel(___,InputSampleRate=Value)
Positive real scalar — The input sample rate of the parallel filter is a positive real scalar.
"normalized"— The input sample rate of the parallel filter is in normalized frequency units regardless of the input sample rate of the individual filter branches."auto"— The input sample rate of the parallel filter is determined from the input sample rate of the individual filter branches as per these conditions:If all the branches have a normalized frequency, then the parallel filter has a normalized frequency.
If more than one branch has an absolute sample rate, then the sample rate of these branches must be consistent with the rate conversion ratio of the segment connecting them. The sample rate of the overall parallel filter is in absolute units.
If at least one branch has an absolute sample rate, then the sample rate of the overall parallel filter is in absolute units.
(since R2026a)
Examples
You can construct a parallel filter using the dsp.ParallelFilter object or the parallel function.
First, create the branches.
B1 = dsp.FIRFilter; B2 = dsp.Delay(3); B3 = 2;
Specify these branches while constructing the dsp.ParallelFilter object.
pf1 = dsp.ParallelFilter(B1,B2,B3)
pf1 =
dsp.ParallelFilter with properties:
Branch1: [1×1 dsp.FIRFilter]
Branch2: [1×1 dsp.Delay]
Branch3: 2
CloneBranches: true
You can also use the addBranch function to add branches to the default parallel filter.
pf2 = dsp.ParallelFilter(B1); addBranch(pf2,B2,B3); pf2
pf2 =
dsp.ParallelFilter with properties:
Branch1: [1×1 dsp.FIRFilter]
Branch2: [1×1 dsp.Delay]
CloneBranches: true
Now, use the parallel filter function to construct a dsp.ParallelFilter object.
pf3 = parallel(B1,B2,B3)
pf3 =
dsp.ParallelFilter with properties:
Branch1: [1×1 dsp.FIRFilter]
Branch2: [1×1 dsp.Delay]
Branch3: 2
CloneBranches: true
Since R2026a
Specify the input sample rate explicitly while constructing the dsp.ParallelFilter object using the InputSampleRate argument.
Parallel Filter with Absolute Sample Rate
Create a dsp.ParallelFilter object with three branches. Each branch is a dsp.FIRFilter object operating in normalized frequency units. Specify the sample rate of the parallel filter as 22050 Hz using the InputSampleRate argument.
filtNorm1 = dsp.FIRFilter;
firtNorm2 = dsp.FIRFilter(designLowpassFIR(FilterOrder=30,CutoffFrequency=0.5,Window="hann"));
filtNorm3 = dsp.FIRFilter(designLowpassFIR(FilterOrder=10,CutoffFrequency=0.5));
parallelSpecifySampleRate = parallel(filtNorm1,firtNorm2,filtNorm3,InputSampleRate=22050)parallelSpecifySampleRate =
dsp.ParallelFilter with properties:
Branch1: [1×1 dsp.FIRFilter]
Branch2: [1×1 dsp.FIRFilter]
Branch3: [1×1 dsp.FIRFilter]
CloneBranches: true
The parallel filter operates at the absolute frequency that you specify regardless of the sample rate of the filter branches.
info(parallelSpecifySampleRate)
ans =
'Discrete-Time Filter Parallel Filter
----------------------------
Number of branches: 3
Branch cloning: enabled
Input sample rate: 22050
----------------------------
Branch1: dsp.FIRFilter
-------
Discrete-Time FIR Filter (real)
-------------------------------
Filter Structure : Direct-Form FIR
Filter Length : 2
Stable : Yes
Linear Phase : Yes (Type 2)
Input sample rate : Normalized
Branch2: dsp.FIRFilter
-------
Discrete-Time FIR Filter (real)
-------------------------------
Filter Structure : Direct-Form FIR
Filter Length : 31
Stable : Yes
Linear Phase : Yes (Type 1)
Input sample rate : Normalized
Branch3: dsp.FIRFilter
-------
Discrete-Time FIR Filter (real)
-------------------------------
Filter Structure : Direct-Form FIR
Filter Length : 11
Stable : Yes
Linear Phase : Yes (Type 1)
Input sample rate : Normalized
'
Parallel Filter with Normalized Sample Rate
Specify normalized sample rate on the cascade. The first branch of the filter cascade has a sample rate of 17 Hz. The remaining filter branches operate in normalized frequency units.
filtAbs1 = dsp.FIRFilter(SampleRate=17); firtNorm2 = dsp.FIRFilter(designLowpassFIR(FilterOrder=30,CutoffFrequency=0.5,Window="hann")); filtNorm3 = dsp.FIRFilter(designLowpassFIR(FilterOrder=10,CutoffFrequency=0.5)); parallelNormSampleRate = parallel(filtAbs1,firtNorm2,filtNorm3,InputSampleRate="normalized")
parallelNormSampleRate =
dsp.ParallelFilter with properties:
Branch1: [1×1 dsp.FIRFilter]
Branch2: [1×1 dsp.FIRFilter]
Branch3: [1×1 dsp.FIRFilter]
CloneBranches: true
The parallel filter operates in normalized frequency units regardless of the sample rate of the individual filter branches.
info(parallelNormSampleRate)
ans =
'Discrete-Time Filter Parallel Filter
----------------------------
Number of branches: 3
Branch cloning: enabled
Input sample rate: Normalized
----------------------------
Branch1: dsp.FIRFilter
-------
Discrete-Time FIR Filter (real)
-------------------------------
Filter Structure : Direct-Form FIR
Filter Length : 2
Stable : Yes
Linear Phase : Yes (Type 2)
Input sample rate : 17
Branch2: dsp.FIRFilter
-------
Discrete-Time FIR Filter (real)
-------------------------------
Filter Structure : Direct-Form FIR
Filter Length : 31
Stable : Yes
Linear Phase : Yes (Type 1)
Input sample rate : Normalized
Branch3: dsp.FIRFilter
-------
Discrete-Time FIR Filter (real)
-------------------------------
Filter Structure : Direct-Form FIR
Filter Length : 11
Stable : Yes
Linear Phase : Yes (Type 1)
Input sample rate : Normalized
'
Parallel Filter with Auto Sample Rate
Set the input sample rate of the parallel filter to "auto". The individual filters have a combination of normalized and absolute sample rates. The parallel filter uses the absolute sample rate.
filtAbs1 = dsp.FIRFilter(SampleRate=17); firtNorm2 = dsp.FIRFilter(designLowpassFIR(FilterOrder=30,CutoffFrequency=0.5,Window="hann")); filtAbs2 = dsp.FIRFilter(designLowpassFIR(FilterOrder=10,CutoffFrequency=0.5),SampleRate=17); parallelAutoSampleRate = parallel(filtAbs1,firtNorm2,filtAbs2,InputSampleRate="auto"); info(parallelAutoSampleRate)
ans =
'Discrete-Time Filter Parallel Filter
----------------------------
Number of branches: 3
Branch cloning: enabled
Input sample rate: 17
----------------------------
Branch1: dsp.FIRFilter
-------
Discrete-Time FIR Filter (real)
-------------------------------
Filter Structure : Direct-Form FIR
Filter Length : 2
Stable : Yes
Linear Phase : Yes (Type 2)
Input sample rate : 17
Branch2: dsp.FIRFilter
-------
Discrete-Time FIR Filter (real)
-------------------------------
Filter Structure : Direct-Form FIR
Filter Length : 31
Stable : Yes
Linear Phase : Yes (Type 1)
Input sample rate : Normalized
Branch3: dsp.FIRFilter
-------
Discrete-Time FIR Filter (real)
-------------------------------
Filter Structure : Direct-Form FIR
Filter Length : 11
Stable : Yes
Linear Phase : Yes (Type 1)
Input sample rate : 17
'
The input sample rate of the parallel filter is set to "auto". The sample rate of the FIR filter and FIR interpolator is in absolute units. Since there is a rate conversion ratio of 3 between the two branches, the sample rate of these branches must be consistent with this rate conversion ratio. The input sample rate of the overall parallel filter is 22050 Hz.
filtNorm1 = dsp.FIRFilter(SampleRate=22050); filtNorm4 = dsp.FIRDecimator(3); % Normalized frequency filtAbs3 = dsp.FIRInterpolator(InputSampleRate=22050/3); parallelAutoSampleRate2 = cascade(filtNorm1,filtNorm4,filtAbs3,InputSampleRate="auto"); info(parallelAutoSampleRate2)
ans =
'Discrete-Time Filter Cascade
----------------------------
Number of stages: 3
Stage cloning: enabled
Input sample rate: 22050
----------------------------
Stage1: dsp.FIRFilter
-------
Discrete-Time FIR Filter (real)
-------------------------------
Filter Structure : Direct-Form FIR
Filter Length : 2
Stable : Yes
Linear Phase : Yes (Type 2)
Input sample rate : 22050
Stage2: dsp.FIRDecimator
-------
Discrete-Time FIR Multirate Filter (real)
-----------------------------------------
Filter Structure : Direct-Form FIR Polyphase Decimator
Decimation Factor : 3
Polyphase Length : 24
Filter Length : 72
Stable : Yes
Linear Phase : Yes (Type 1)
Arithmetic : double
Input sample rate : Normalized
Stage3: dsp.FIRInterpolator
-------
Discrete-Time FIR Multirate Filter (real)
-----------------------------------------
Filter Structure : Direct-Form FIR Polyphase Interpolator
Interpolation Factor : 3
Polyphase Length : 24
Filter Length : 72
Stable : Yes
Linear Phase : Yes (Type 1)
Arithmetic : double
Input sample rate : 7350
'
Consider a parallel filter with nested branches. The input sample rate of the first parallel filter is 22050 Hz. The input sample rate of the second parallel filter is "normalized".
Create a parallel filter with these two filter structures as branches and set the input sample rate of the overall parallel filter to "auto".
filtParallelSpecifySampleRate = dsp.ParallelFilter(InputSampleRate=22050)
filtParallelSpecifySampleRate =
dsp.ParallelFilter with properties:
Branch1: [1×1 dsp.FIRFilter]
CloneBranches: true
filtParallelNormSampleRate = dsp.ParallelFilter(InputSampleRate="normalized")filtParallelNormSampleRate =
dsp.ParallelFilter with properties:
Branch1: [1×1 dsp.FIRFilter]
CloneBranches: true
filtNestedParallel = parallel(filtParallelSpecifySampleRate,filtParallelNormSampleRate,InputSampleRate="auto")filtNestedParallel =
dsp.ParallelFilter with properties:
Branch1: [1×1 dsp.ParallelFilter]
Branch2: [1×1 dsp.ParallelFilter]
CloneBranches: true
The first parallel filter has an absolute sample rate and the second parallel filter operates in normalized frequency units. The nested parallel filter in the "auto" configuration uses the absolute sample rate.
info(filtNestedParallel)
ans =
'Discrete-Time Filter Parallel Filter
----------------------------
Number of branches: 2
Branch cloning: enabled
Input sample rate: Normalized
----------------------------
Branch1: dsp.ParallelFilter
-------
Discrete-Time Filter Parallel Filter
----------------------------
Number of branches: 1
Branch cloning: enabled
Input sample rate: 22050
----------------------------
Branch1: dsp.FIRFilter
-------
Discrete-Time FIR Filter (real)
-------------------------------
Filter Structure : Direct-Form FIR
Filter Length : 2
Stable : Yes
Linear Phase : Yes (Type 2)
Input sample rate : Normalized
Branch2: dsp.ParallelFilter
-------
Discrete-Time Filter Parallel Filter
----------------------------
Number of branches: 1
Branch cloning: enabled
Input sample rate: Normalized
----------------------------
Branch1: dsp.FIRFilter
-------
Discrete-Time FIR Filter (real)
-------------------------------
Filter Structure : Direct-Form FIR
Filter Length : 2
Stable : Yes
Linear Phase : Yes (Type 2)
Input sample rate : Normalized
'
Input Arguments
Filter branch, specified as a filter System object or a scalar gain value. The parallel function
does not create a dsp.ParallelFilter object when all input
branches are scalar values. At least one branch in the structure must be a filter
object.
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
Since R2026a
Input sample rate of the parallel filter, specified as one of these:
Positive real scalar — The input sample rate of the parallel filter is a positive real scalar.
"normalized"— The input sample rate of the parallel filter is in normalized frequency units regardless of the input sample rate of the individual filter branches."auto"— The input sample rate of the parallel filter is determined from the input sample rate of the individual filter branches as per these conditions:If all the branches have a normalized frequency, then the parallel filter has a normalized frequency.
If more than one branch has an absolute sample rate, then the sample rate of these branches must be consistent with the rate conversion ratio of the segment connecting them. The sample rate of the overall parallel filter is in absolute units.
If at least one branch has an absolute sample rate, then the sample rate of the overall parallel filter is in absolute units.
Data Types: single | double | char | string
Output Arguments
Parallel filter, returned as a System object of type dsp.ParallelFilter. For information on the
properties of the filter in each branch, type info(PF) in the
MATLAB command prompt.
Version History
Introduced before R2006aUsing the InputSampleRate argument, you can now specify the
input sample rate explicitly while constructing the dsp.ParallelFilter
object using the parallel function.
To specify the input sample rate after constructing the object, use the setInputSampleRate function.
You can view the sample rate information using the Input sample
rate field of the info function.
Starting in R2023b, the parallel analysis function generates a
dsp.ParallelFilter object.
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)