| Communications Toolbox | ![]() |
Produce a quantization index and a quantized output value
Syntax
index = quantiz(sig,partition); [index,quants] = quantiz(sig,partition,codebook); [index,quants,distor] = quantiz(sig,partition,codebook);
Description
index = quantiz(sig,partition)
returns the quantization levels in the real vector signal sig using the parameter partition. partition is a real vector whose entries are in strictly ascending order. If partition has length n, then index is a column vector whose kth entry is
[index,quants] = quantiz(sig,partition,codebook)
is the same as the syntax above, except that codebook prescribes a value for each partition in the quantization and quants contains the quantization of sig based on the quantization levels and prescribed values. codebook is a vector whose length exceeds the length of partition by one. quants is a row vector whose length is the same as the length of sig. quants is related to codebook and index by
where ii is an integer between 1 and length(sig).
[index,quants,distor] = quantiz(sig,partition,codebook)
is the same as the syntax above, except that distor estimates the mean square distortion of this quantization data set.
Examples
The command below rounds several numbers between 1 and 100 up to the nearest multiple of ten. quants contains the rounded numbers, and index tells which quantization level each number is in.
[index,quants] = quantiz([3 34 84 40 23],10:10:90,10:10:100) index = 0 3 8 3 2 quants = 10 40 90 40 30
See Also
lloyds, dpcmenco, dpcmdeco
| qaskenco | randerr | ![]() |