Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

fdesign.bandstop

Bandstop filter specification object

Syntax

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)

Description

D = fdesign.bandstop constructs a bandstop filter specification object D, applying default values for the properties Fpass1, Fstop1, Fstop2, Fpass2, Apass1, Astop1 and Apass2.

D = fdesign.bandstop(SPEC) constructs object D and sets the Specification property to SPEC. Entries in SPEC represent various filter response features, such as the filter order, that govern the filter design. Valid entries for SPEC are shown below. These entries are not case sensitive.

    Note:   Specification options marked with an asterisk require the DSP System Toolbox™ software.

  • 'Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2' (default spec)

  • '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,Fc1,Fc2,Ap1,Ast,Ap2'

  • 'N,Fp1,Fp2,Ap'

  • 'N,Fp1,Fp2,Ap,Ast'

  • 'N,Fp1,Fst1,Fst2,Fp2'

  • 'N,Fp1,Fst1,Fst2,Fp2,C' *

  • 'N,Fp1,Fst1,Fst2,Fp2,Ap' *

  • 'N,Fst1,Fst2,Ast'

  • 'Nb,Na,Fp1,Fst1,Fst2,Fp2' *

The filter specifications are defined as follows:

  • Ap — amount of ripple allowed in the passband in decibels (the default units). Also called Apass.

  • Ap1 — amount of ripple allowed in the pass band in decibels (the default units). Also called Apass1.

  • Ap2 — amount of ripple allowed in the pass band in decibels (the default units). Also called Apass2.

  • 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.

  • C — Constrained band flag. This enables you to specify passband ripple or stopband attenuation for fixed-order designs in one or two of the three bands.

    In the specification 'N,Fp1,Fst1,Fst2,Fp2,C', you cannot specify constraints simultaneously in both passbands and the stopband. You can specify constraints in any one or two bands.

  • F3dB1 — cutoff frequency for the point 3 dB point below the passband value for the first cutoff.

  • F3dB2 — cutoff frequency for the point 3 dB point below the passband value for the second cutoff.

  • Fc1 — cutoff frequency for the point 6 dB point below the passband value for the first cutoff. (FIR filters)

  • Fc2 — cutoff frequency for the point 6 dB point below the passband value for the second cutoff. (FIR filters)

  • Fp1 — frequency at the start of the pass band. Also called Fpass1.

  • Fp2 — frequency at the end of the pass band. Also called Fpass2.

  • Fst1 — frequency at the end of the first stop band. Also called Fstop1.

  • Fst2 — frequency at the start of the second stop band. 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. Use designmethods to determine which design methods apply to an object and the Specification property value.

Use designopts to determine the design options for a given design method. Enter help(D,METHOD) at the MATLAB® command line to obtain detailed help on the design options for a given design method, METHOD.

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, 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. If you specify the sampling frequency as a trailing scalar, 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.

Examples

collapse all

Construct a bandstop filter to reject the discrete frequency band between 3π/8 and 5π/8 rad/sample. Apply the filter to a discrete-time signal consisting of the superposition of three discrete-time sinusoids.

Design an FIR equiripple filter and view its magnitude response.

d = fdesign.bandstop('Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2', ...
    2/8,3/8,5/8,6/8,1,60,1);
Hd = design(d,'equiripple');

fvtool(Hd)

Construct the discrete-time signal and filter it.

n = 0:99;
x = cos(pi/5*n)+sin(pi/2*n)+cos(4*pi/5*n);
y = filter(Hd,x);

Plot the original and filtered signals in the frequency domain.

xdft = fft(x);
ydft = fft(y);
freq = 0:(2*pi)/length(x):pi;

plot(freq/pi,abs(xdft(1:length(x)/2+1)))
hold on
plot(freq/pi,abs(ydft(1:length(y)/2+1)),'r','linewidth',2)
hold off
xlabel('Normalized Frequency (\times\pi rad/sample)')
ylabel('Magnitude')
legend('Original Signal','Bandstop Signal')

Create a Butterworth bandstop filter for data sampled at 10 kHz. The stopband is [1,1.5] kHz. The order of the filter is 20. Visualize the frequency response.

d = fdesign.bandstop('N,F3dB1,F3dB2',20,1e3,1.5e3,1e4);
Hd = design(d,'butter');

fvtool(Hd)

Zoom in on the magnitude response plot to verify that the 3-dB down points are located at 1 and 1.5 kHz.

axis([0.5 2 -5 2])

Design a constrained-band FIR equiripple filter of order 100 for data sampled at 10 kHz. You can specify constraints on at most two of the three bands: two passbands and one stopband. In this example, constrain the passband ripple to be 0.5 dB in each passband.

d = fdesign.bandstop('N,Fp1,Fst1,Fst2,Fp2,C',100,800,1e3,1.5e3,1.7e3,1e4);
d.Passband1Constrained = true; d.Apass1 = 0.5;
d.Passband2Constrained = true; d.Apass2 = 0.5;
Hd = design(d,'equiripple');

Visualize the magnitude response and measure the design.

fvtool(Hd)
measure(Hd)
ans = 

Sample Rate             : 10 kHz     
First Passband Edge     : 800 Hz     
First 3-dB Point        : 852.4565 Hz
First 6-dB Point        : 881.7834 Hz
First Stopband Edge     : 1 kHz      
Second Stopband Edge    : 1.5 kHz    
Second 6-dB Point       : 1.6185 kHz 
Second 3-dB Point       : 1.6478 kHz 
Second Passband Edge    : 1.7 kHz    
First Passband Ripple   : 0.49642 dB 
Stopband Atten.         : 48.8466 dB 
Second Passband Ripple  : 0.49634 dB 
First Transition Width  : 200 Hz     
Second Transition Width : 200 Hz     
 

With this order filter and passband ripple constraints, you achieve approximately 50 dB of stopband attenuation.

Introduced in R2009a

Was this topic helpful?