%% Design Single-Band Arbitrary-Magnitude Filter
% Use fdesign.arbmag to design a single band equiripple filter.
% Specify 100 frequency points.

n = 120;
f = linspace(0,1,100);

as = ones(1,100)-f*0.2;
absorb = [ones(1,30),1-0.6*bohmanwin(10)',ones(1,5), ...
    1-0.5*bohmanwin(8)',ones(1,47)];
a = as.*absorb;

d = fdesign.arbmag('N,F,A',n,f,a);
hd1 = design(d,'equiripple');

%
% Design a minimum-phase equiripple filter. Visualize the poles and zeros of the two filters.

hd2 = design(d,'equiripple','MinPhase',true);

hfvt = fvtool(hd1,hd2,'Analysis','polezero');
legend(hfvt,'Equiripple Filter','Minimum-phase Equiripple Filter')

% Copyright 2012 The MathWorks, Inc.