DADiSP Worksheet Functions > Function Categories > Fourier Transforms and Signal Processing > QUANTIZE
Quantizes an input series to N levels.
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 |
xh |
- |
Optional. A real, the high value input range. Defaults to |
yl |
- |
Optional. A real, the low value output range. Defaults to xl. |
yh |
- |
Optional. A real, the high value output range. Defaults to xh. |
A series or real.
quantize(1..100, 10)
returns a 100 points series with quantize values of 1, 12, 23, 34, 45, 56, 67, 78, 89, 100.
W1: gcos(100, .01, 2)
W2: quantize(W1, 2^4)
The cosine is quantized to 16 levels ranging from -1 to 1.
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.
W1: gcos(100, .01, 2);setlinewidth(2);shadewith(W2);rainbow
W2: quantize(W1, 10);plotmode(W1, 1)
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.
QUANTIZE quantizes a series to any number of quantization levels.
Use BITQUANT to specifically quantize a series to 2n levels.