Updated 19 Jun 2009
This group of routines designs and evaluates scalar quantizers. A scalar quantizer is defined by a set of decision values and a set of output values. The Lloyd-Max algorithms are used to design minimum-mean-square error scalar quantizers based on a given probability density functions.
There are two basic design routines: QuantOpt to design general non-uniformly spaced quantizers, and QuantUnif to design uniformly spaced quantizers. For each, the quantizer can additionally be constrained to have symmetrically spaced levels. A number of different probability density functions are supported.
1. Uniform: Uniform pdf leading to a uniform quantizer
2. Gaussian: Gaussian pdf
3. Laplace: Two-sided laplace pdf
4. Sine: pdf for a sinusoid with random phase
5. Gamma: Gamma pdf (generalized gamma distribution with parameter 1/2)
6. Generalized Gamma: Generalized gamma pdf specified with an additional parameter
7. Tabulated: A pdf specified by a set of points. The points are (x,p) pairs. The pdf is assumed to be linear between the given points and zero outside the points. For sufficiently smooth pdf’s, the tabulated option can be used to design minimum mean-square error quantizers for arbitrary pdf’s by supplying samples of the pdf.
The initial search for a quantizer which satisfies the necessary conditions for minimum mean-square error is done using a one-dimensional search (Lloyd algorithm). A refinement step using the Lloyd-Max iteration is then carried out.
The quantizer is evaluated by calculating the resulting mean-square error (and SNR in dB), and the quantizer entropy. The evaluation routines QuantSNR can be used for any quantizer (whether designed by the design routines described above or not).
The routines QuantALawTables and QuantMuLawTables generate quantizer tables for log-PCM quantization as per ITU-T Recommendation G.711.
The routine Quant efficiently carries out quantization. Internally it uses the Matlab routine histc. This routine is more efficient than the Matlab function quantiz (Communications Toolbox). Quant has an option for having input values which lie exactly at the decision boundaries round up or round down.
Peter Kabal (2023). Quantizers (https://www.mathworks.com/matlabcentral/fileexchange/24333-quantizers), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.