Documentation

unitquantize

Quantize except numbers within eps of +1

Syntax

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

Description

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),...

Examples

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 =

    0.1250

Introduced in R2008a

Was this topic helpful?