%% Maximize Stopband Attenuation
% Maximize stopband attenuation for 16-bit fixed-point filter.

Hf = fdesign.lowpass('Fp,Fst,Ap,Ast',0.4,0.45,0.5,60);
Hd = design(Hf,'equiripple');

%
% Use 16 bits to represent coefficients.

WL = 16; 
Hq = maximizestopband(Hd,WL);

%
% Compare stopband attenuation

md = measure(Hd)

%

mq = measure(Hq)

%

hfvt=fvtool(Hd,Hq,'ShowReference','off');
legend(hfvt,'Floating-point Filter','Fixed-point Filter');

% Copyright 2012 The MathWorks, Inc.