Maximize stopband attenuation of fixed-point filter


Hq = maximizestopband(Hd,Wordlength)
Hq = maximizestopband(Hd,Wordlength,'Ntrials',N)


Hq = maximizestopband(Hd,Wordlength) quantizes the single-stage or multistage FIR filter Hd and returns the fixed-point filter Hq with wordlength wordlength that maximizes the stopband attenuation. Hd must be generated using fdesign and design. For multistage filters, wordlength can either be a scalar or vector. If wordlength is a scalar, the same wordlength is used for all stages. If wordlength is a vector, each stage uses the corresponding element in the vector. The vector length must equal the number of stages. maximizestopband uses a stochastic noise-shaping procedure by default to minimize the wordlength. To obtain repeatable results on successive function calls, initialize the uniform random number generator rand

Hq = maximizestopband(Hd,Wordlength,'Ntrials',N) specifies the number of Monte Carlo trials to use in the maximization. Hq is the fixed-point filter with the largest stopband attenuation among the trials. The number of Monte Carlo trials N defaults to 1.

You must have the Fixed-Point Designer™ software installed to use this function.


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');
WL = 16; % use 16 bits to represent coefficients
Hq = maximizestopband(Hd,WL);
% Compare stopband attenuation
md = measure(Hd);
mq = measure(Hq);
legend(hfvt,'Floating-point Filter','Fixed-point Filter');

Related Examples

Introduced in R2011a

Was this topic helpful?