Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

constraincoeffwl

Constrain coefficient wordlength

Syntax

Hq = constraincoeffwl(Hd,wordlength)
Hq = constraincoeffwl(Hd,wordlength,'Ntrials',N)
Hq = constraincoeffwl(Hd,wordlength,...,'NoiseShaping',NSFlag)
Hq = constraincoeffwl(Hd,wordlength,...,'Apasstol',Apasstol)
Hq = constraincoeffwl(Hd,wordlength,...,'Astoptol',Astoptol)

Description

Hq = constraincoeffwl(Hd,wordlength) returns a fixed-point filter Hq meeting the design specifications of the single-stage or multistage FIR filter object Hd with a wordlength of at most wordlength bits. 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. Hd must be generated using fdesign and design. constraincoeffwl 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 = constraincoeffwl(Hd,wordlength,'Ntrials',N) specifies the number of Monte Carlo trials to use. Hq is first filter among the trials to meet the specifications in Hd with a wordlength of at most wordlength.

Hq = constraincoeffwl(Hd,wordlength,...,'NoiseShaping',NSFlag) enables or disables the stochastic noise-shaping procedure in the constraint of the wordlength. By default NSFlag is true. Setting NSFlag to false constrains the wordlength without using noise-shaping.

Hq = constraincoeffwl(Hd,wordlength,...,'Apasstol',Apasstol) specifies the passband ripple tolerance in dB. 'Apasstol' defaults to 1e-4.

Hq = constraincoeffwl(Hd,wordlength,...,'Astoptol',Astoptol) specifies the stopband tolerance in dB. 'Astoptol' defaults to 1e-2

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

Examples

collapse all

Design fixed-point filter with a wordlength of at most 11 bits using constraincoeffwl

Hf = fdesign.lowpass('Fp,Fst,Ap,Ast',.4,.5,1,60);
Hd = design(Hf,'equiripple'); % 43 coefficients
Hq = constraincoeffwl(Hd,11); % 45 11-bit coefficients
hfvt = fvtool(Hd,Hq);
legend(hfvt,'Floating-point Filter','Fixed-point Filter');

Related Examples

Introduced in R2011a

Was this topic helpful?