Skip to Main Content Skip to Search
Product 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

See Also

eps | quantize | quantizer | unitquantizer

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS