
Quantizer |
ptolemy.actor.lib.Quantizer |
Produce an output token on each firing with a value that is
a quantized version of the input. The input and output types
are both double.
The levels parameter contains an array of doubles
specifying the quantization levels. The elements must be in
an increasing order, or an exception will be thrown.
The default value of levels is {-1.0, 1.0}.
Suppose u is the input, and
levels = {a, b, c}, where
a < b < c, then the output of the actor will be:
y = a, for u <= (b+a)/2;
y = b, for (b+a)/2 <
u <= (c+b)/2;
y = c, for u > (c+b)/2;
Thus, for the default levels, the output is (almost)
the signum function of the input, or +1.0 if the input is positive,
and -1.0 otherwise. This is almost the signum function because it
outputs -1.0 if the input is zero.
This actor does not require that the quantization intervals be equal,
i.e. we allow that (c-b) != (b-a).
Author(s): Jie Liu
Version:$Id: Quantizer.java,v 1.40 2005/10/28 20:14:54 cxh Exp $
Pt.Proposed Rating:Yellow (liuj)
Pt.Accepted Rating:Yellow (yuhong)
levels
The quantization levels.
This parameter contains an array of doubles with default value
{-1.0, 1.0}.