QUANTIZE

Purpose:

Quantizes an input series to N levels.

Syntax:

QUANTIZE(xi, levels, xl, xh yl, yh)

xi

-

An input series or scalar.

levels

-

Optional. An integer, the number of quantization levels. Defaults to 256.

xl

-

Optional. A real, the low value input range. Defaults to min(s).

xh

-

Optional. A real, the high value input range. Defaults to max(s).

yl

-

Optional. A real, the low value output range. Defaults to xl.

yh

-

Optional. A real, the high value output range. Defaults to xh.

Returns:

A series or real.

Example:

quantize(1..100, 10)

 

returns a 100 points series with quantize values of 1, 12, 23, 34, 45, 56, 67, 78, 89, 100.

Example:

W1: gcos(100, .01, 2)

W2: quantize(W1, 2^4)

 

The cosine is quantized to 16 levels ranging from -1 to 1.

Example:

W3: quantize(W1, 2^4, min(W1), max(W1), 0, 2^4 - 1)

 

The cosine is quantized to 16 levels ranging from 0 to 15.

Example:

W1: gcos(100, .01, 2);setlinewidth(2);shadewith(W2);rainbow

W2: quantize(W1, 10);plotmode(W1, 1)

 

image\quantizepic.gif

 

The cosine is quantized to 10 levels ranging from -1 to 1. W1 is shaded to show the 10 distinct levels. The line width is thickened to highlight the color shading.

Remarks:

QUANTIZE quantizes a series to any number of quantization levels.

 

Use BITQUANT to specifically quantize a series to 2n levels.

See Also:

BITQUANT

BITSCALE

LINSCALE