LINSCALE

Purpose:

Linearly re-scales an input series.

Syntax:

LINSCALE(xi, xl, xh, yl, yh, clipflag)

xi

-

An input series or scalar.

xl

-

A real. The low value input range.

xh

-

A real. The high value input range.

yl

-

A real. The low value output range.

yh

-

A real. The high value output range.

clipflag

-

Optional. An integer, the out of range clipping method:

0:

do not clip

1:

clip input to xl and xh (default)

Returns:

A series or real.

Example:

linscale(10, 0, 100, -1, 1)

 

returns -0.8, the corresponding output for an input value of 10.0 on a 0 to 100 input range and a corresponding -1.0 to 1.0 output range.

Example:

linscale(0..100, 0.0, 100, -5, 5)

 

returns a series ranging from -5 to 5.

Remarks:

By default, LINSCALE automatically clips out of range input values.

See Also:

BITSCALE

RESCALE

QUANTIZE