| Communications Toolbox | ![]() |
Produce quantization index and quantized output value
index = quantiz(sig,partition)
[index,quants] = quantiz(sig,partition,codebook)
[index,quants,distor] = quantiz(sig,partition,codebook)
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 vector whose kth entry is
0 if sig(k) ≤ partition(1)
m if partition(m) < sig(k) ≤ partition(m+1)
n if partition(n) < sig(k)
[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
quants(ii) = codebook(index(ii)+1);
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.
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)
The output is below.
index =
0 3 8 3 2
quants =
10 40 90 40 30
lloyds, dpcmenco, dpcmdeco, Quantizing a Signal
| qfuncinv | randdeintrlv | ![]() |
© 1994-2005 The MathWorks, Inc.