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
returns the fixed-point filter
Hq with wordlength
maximizes the stopband attenuation.
Hd must be
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
a vector, each stage uses the corresponding element in the vector.
The vector length must equal the number of stages.
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
Hq = maximizestopband(Hd,Wordlength,'Ntrials',N) specifies
the number of Monte Carlo trials to use in the maximization.
the fixed-point filter with the largest stopband attenuation among
the trials. The number of Monte Carlo trials
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');
Use 16 bits to represent coefficients.
WL = 16; Hq = maximizestopband(Hd,WL);
Compare stopband attenuation
md = measure(Hd)
md = Sample Rate : N/A (normalized frequency) Passband Edge : 0.4 3-dB Point : 0.41178 6-dB Point : 0.41845 Stopband Edge : 0.45 Passband Ripple : 0.49369 dB Stopband Atten. : 60.0697 dB Transition Width : 0.05
mq = measure(Hq)
mq = Sample Rate : N/A (normalized frequency) Passband Edge : 0.4 3-dB Point : 0.41178 6-dB Point : 0.41845 Stopband Edge : 0.45 Passband Ripple : 0.49773 dB Stopband Atten. : 59.9728 dB Transition Width : 0.05
hfvt=fvtool(Hd,Hq,'ShowReference','off'); legend(hfvt,'Floating-point Filter','Fixed-point Filter');