This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Quantize except numbers within eps of +1


y = unitquantize(q, x)
[y1,y2,...] = unitquantize(q,x1,x2,...)


y = unitquantize(q, x) works the same as quantize except that numbers within eps(q) of +1 are made exactly equal to +1 .

[y1,y2,...] = unitquantize(q,x1,x2,...) is equivalent to y1 = unitquantize(q,x1), y2 = unitquantize(q,x2),...


This example demonstrates the use of unitquantize with a quantizer object q and a vector x.

q = quantizer('fixed','floor','saturate',[4 3]);
x = (0.8:.1:1.2)';
y = unitquantize(q,x);
z = [x y]
e = eps(q)

This quantization outputs an array containing the original values of x and the quantized values of x, followed by the value of eps(q):

z =

    0.8000    0.7500
    0.9000    1.0000
    1.0000    1.0000
    1.1000    1.0000
    1.2000    1.0000

e =


Introduced in R2008a