Filter Design Toolbox    
quantize

Apply a quantizer to data

Syntax

Description

y = quantize(q, x) uses the quantizer q to quantize x. When x is a numeric array, each element of x is quantized. When x is a cell array, each numeric element of the cell array is quantized. When x is a structure, each numeric field of x is quantized. Nonnumeric elements or fields of x are left unchanged and quantize does not issue warnings for nonnumeric values.

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

The quantizer states

are updated during the call to quantize, and running totals are kept until a call to reset is made.

Examples

The following examples demonstrate using quantize to quantize data.

Example 1 - Custom Precision Floating-Point

The code listed here produces the plot shown in the following figure.

Example 2 - Fixed-Point

The code listed here produces the plot shown in the following figure.

See Also
quantizer, set


  qreport quantizer 

Learn more about the latest releases of MathWorks products:

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