%% Design a Constrained Lowpass Filter
% Design a 12th-order lowpass filter with a constraint on the filter response.

b = fircband(12,[0 0.4 0.5 1], [1 1 0 0], ...
[1 0.2], {'w' 'c'});

%
% Using fvtool to display the result b shows you the response of the filter you designed.

fvtool(b)

%
% Design two filters of different order with the stopband constrained to 60 dB. Use excess order (80) in the second filter to improve the passband ripple.

b1 = fircband(60,[0 .2 .25 1],[1 1 0 0],...
[1 .001],{'w','c'});
b2 = fircband(80,[0 .2 .25 1],[1 1 0 0],...
[1 .001],{'w','c'});
hfvt = fvtool(b1,1,b2,1);
legend(hfvt,'Filter Order 60','Filter Order 80');

% Copyright 2012 The MathWorks, Inc.