| Filter Design Toolbox™ | ![]() |
d = fdesign.bandstop
d = fdesign.bandstop(spec)
d = fdesign.bandstop(spec,specvalue1,specvalue2,...)
d = fdesign.bandstop(specvalue1,specvalue2,specvalue3,specvalue4,...
specvalue5,specvalue6,specvalue7)
d = fdesign.bandstop(...,fs)
d = fdesign.bandstop(...,magunits)
d = fdesign.bandstop constructs a bandstop filter specification object d, applying default values for the properties Fpass1, Fstop1, Fstop2, Fpass2, Apass1, Astop1 and Apass2.
Using fdesign.bandstop with a design method generates a dfilt object.
d = fdesign.bandstop(spec) constructs object d and sets its 'Specification' to spec. Entries in the spec string represent various filter response features, such as the filter order, that govern the filter design. Valid entries for spec are shown below. The strings are not case sensitive.
fp1,fst1,fst2,fp2,ap1,ast,ap2 (defaultspec)
n,f3dB1,f3dB2
n,f3dB1,f3dB2,ap
n,f3dB1,f3dB2,ap,ast
n,f3dB1,f3dB2,ast
n,f3dB1,f3dB2,bwp
n,f3dB1,f3dB2,bwst
n,fc1,fc2
n,fp1,fp2,ap
n,fp1,fp2,ap,ast
n,fp1,fst1,fst2,fp2
n,fp1,fst1,fst2,fp2,ap
n,fst1,fst2,ast
nb,na,fp1,fst1,fst2,fp2
The string entries are defined as follows:
ap — amount of ripple allowed in the passband in decibels (the default units). Also called Apass.
ast — attenuation in the first stopband in decibels (the default units). Also called Astop1.
bwp — bandwidth of the filter passband. Specified in normalized frequency units.
bwst — bandwidth of the filter stopband. Specified in normalized frequency units.
f3dB1 — cutoff frequency for the point 3 dB point below the passband value for the first cutoff. Specified in normalized frequency units.
f3dB2 — cutoff frequency for the point 3 dB point below the passband value for the second cutoff. Specified in normalized frequency units.
fp1 — frequency at the start of the pass band. Specified in normalized frequency units. Also called Fpass1.
fp2 — frequency at the end of the pass band. Specified in normalized frequency units. Also called Fpass2.
fst1 — frequency at the end of the first stop band. Specified in normalized frequency units. Also called Fstop1.
fst2 — frequency at the start of the second stop band. Specified in normalized frequency units. Also called Fstop2.
n — filter order.
na — denominator order for IIR filters.
nb — numerator order for IIR filters.
Graphically, the filter specifications look similar to those shown in the following figure.

Regions between specification values like fp1 and fst1 are transition regions where the filter response is not explicitly defined.
The filter design methods that apply to a bandstop filter specification object change depending on the Specification string. Use designmethods to determine which design method applies to an object and its specification string.
d = fdesign.bandstop(spec,specvalue1,specvalue2,...) constructs an object d and sets its specifications at construction time.
d = fdesign.bandstop(specvalue1,specvalue2,specvalue3,specvalue4,...
specvalue5,specvalue6,specvalue7) constructs
an object d with the default Specification property string fpass1,fstop1,fstop2,fpass2,apass1,astop,apass2, using the values you provide in specvalue1,specvalue2,specvalue3,specvalue4,specvalue5,
specvalue6 and specvalue7.
d = fdesign.bandstop(...,fs) adds the argument fs, specified in Hz to define the sampling frequency to use. In this case, all frequencies in the specifications are in Hz as well.
d = fdesign.bandstop(...,magunits) specifies the units for any magnitude specification you provide in the input arguments. magunits can be one of
linear — specify the magnitude in linear units
dB — specify the magnitude in dB (decibels)
squared — specify the magnitude in power units
When you omit the magunits argument, fdesign assumes that all magnitudes are in decibels. Note that fdesign stores all magnitude specifications in decibels (converting to decibels when necessary) regardless of how you specify the magnitudes.
These examples show how to construct a bandpass filter specification object. First, create a default specifications object without using input arguments.
d = fdesign.bandstop
d =
Response: 'Minimum-order bandstop'
Description: {7x1 cell}
Specification: 'Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2'
NormalizedFrequency: true
Fpass1: 0.3500
Fstop1: 0.4500
Fstop2: 0.5500
Fpass2: 0.6500
Apass1: 1
Astop: 60
Apass2: 1Now create an object by passing a specification type string 'n,fc1,fc2' — the resulting object uses default values for n, fc1, and fc2.
d=fdesign.bandstop('n,f3dB1,f3dB2')
d =
Response: 'Bandstop with cutoff'
Specification: 'N,F3dB1,F3dB2'
Description: {3x1 cell}
NormalizedFrequency: true
FilterOrder: 10
Fcutoff1: 0.4000
Fcutoff2: 0.6000
designmethods(d)
Design Methods for class fdesign.bandstop:
butter
cheby1
cheby2
ellipCreate another bandstop filter, passing the specification values to the object rather than accepting the default values for n, f3db1, and fc2. You can add fs as the final input argument to specify the sampling frequency of 48 kHz.
d = fdesign.bandstop('n,f3db1,f3db2', 10, 9600, ...
14400, 48000)
d =
Response: 'Bandstop with cutoff'
Specification: 'N,F3dB1,F3dB2'
Description: {3x1 cell}
NormalizedFrequency: false
Fs: 48000
FilterOrder: 10
Fcutoff1: 9600
Fcutoff2: 14400For this bandstop filter, pass the filter specifications that correspond to the default Specification — fp1,fst1,fst2,fp2,ap1,ast,ap2.
d = fdesign.bandstop(0.3,0.4,0.6,0.7,0.5,60,1)
d =
Response: 'Minimum-order bandstop'
Specification: 'Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2'
Description: {7x1 cell}
NormalizedFrequency: true
Fpass1: 0.3000
Fstop1: 0.4000
Fstop2: 0.6000
Fpass2: 0.7000
Apass1: 0.5000
Astop: 60
Apass2: 1And for the final example, pass the magnitude specifications in squared units, using the magunits option squared.
d = fdesign.bandstop(0.4,0.5,0.6,0.7,0.98,...
0.01,0.99,'squared')
d =
Response: 'Minimum-order bandstop'
Specification: 'Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2'
Description: {7x1 cell}
NormalizedFrequency: true
Fpass1: 0.4000
Fstop1: 0.5000
Fstop2: 0.6000
Fpass2: 0.7000
Apass1: 0.0877
Astop: 20
Apass2: 0.0436fdesign, fdesign.bandpass, fdesign.highpass, fdesign.lowpass
![]() | fdesign.bandpass | fdesign.ciccomp | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |