Filter Design Toolbox    
errmean

Return the mean of the quantization error resulting from quantizing a signal

Syntax

Description

qerr = errmean(q) returns the mean value of the uniformly distributed random quantization error that results when you use quantizer q to quantize a signal.

The value of qerr does not depend on the signal quantized unless the precision (the value of the least significant bit) of your signal and your quantizer are very nearly the same. Use eps to determine the precision for quantizers or varied word lengths.

When the precision of your signal is close to the precision of your quantizer, qerr may not match the theoretical value. When your signal has infinite extent and infinite precision, the value calculated for qerr matches the theoretical value of the mean of the uniformly distributed quantization error.

For most purposes, when the difference in precision between a signal and the quantizers is greater then 16 bits, the result calculated by errmean is exact. When you reduce the word length by three or four bits through quantization, errmean generates an excellent approximation. For word length changes that exceed four bits, errmean provides a less good match to the theoretical mean. For fixed-point quantizers, the word length property defines the precision.

As you change the rounding mode for your quantizer, the mean error value changes as well, as shown in this table.

Round Mode
Probability Density Function (f(x) = pdf)
Mean (µ)
Variance (2)
dB = 10log102
ceil
1/;        ;      0 otherwise
/2
2/12
-6.02f - 10.79
convergent
1/;   ;  0 otherwise
0
2/12
-6.02f - 10.79
fix
1/(2);   ;      0 otherwise
0
2/3
-6.02f - 4.77
floor
1/;       ;      0 otherwise
-/2
2/12
-6.02f - 10.79
round
1/;   ;  0 otherwise
0
2/12
-6.02f - 10.79

In the table, represents the quantization level (eps(q)) for your quantizer, x is the uniformly distributed random quantization error, and f is the word length of the quantizer.

For more information about the errmean algorithm, and for a discussion about correction factors for quantizing from one fixed-point format and precision to another, refer to [1] in the References section.

Examples

Compare the mean value determined by Monte Carlo methods to the mean value computed by errmean. In this example, the fraction length for q equals 15 bits (eps = 3.0518e-005) and the fraction length for the signal u is 31 bits (eps = 4.6566e-010).

Algorithm

You use similar equations to calculate the mean value for the five rounding modes. In the following equations, x = y-u, where u is the original signal and y is the signal value after quantization. is the minimum quantization step for the quantizer. For all of the following, f(x) denotes the probability density function of the error.

Ceil mode

Convergent mode

Fix mode

Floor mode

Round mode

See Also

quantizer/errpdf, quantizer/errvar

References

[1]  Schlichthärle, Dietrich, Digital Filter, Springer, 2000, Section 8.3 "Quantization," pp. 233-240


  eps errpdf 

Learn more about the latest releases of MathWorks products:

 © 1994-2009 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS