%% Equiripple FIR Bandstop Filter
% 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)

% With this order filter and passband ripple constraints, you achieve approximately 50 dB of stopband attenuation.
% Copyright 2012 The MathWorks, Inc.