主要内容

maximizestopband

Maximize stopband attenuation of fixed-point filter

Syntax

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

Description

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.

Examples

collapse all

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                      
 

Version History

Introduced in R2011a