RESCALE

Purpose:

Linearly rescales an input series.

Syntax:

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

xi

-

An input series or scalar.

yl

-

A real. The low value output range. Defaults to 0.0.

yh

-

A real. The high value output range. Defaults to 1.0.

xl

-

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

xh

-

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

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:

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

 

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:

rescale(0..100)

 

returns a series ranging from 0 to 1. This is equivalent to:

 

rescale(0..100, 0, 1, 0, 100)

Example:

rescale(0..100, -5, 5)

 

returns a series ranging from -5 to 5. This is equivalent to:

 

rescale(0..100, -5, 5, 0, 100)

Example:

rescale(0..100, -5, 5, -200, 200)

 

returns a series ranging from 0 to 2.5

Remarks:

By default, RESCALE automatically clips out of range input values. RESCALE uses LINSCALE to linearly convert the input values.

See Also:

BITSCALE

LINSCALE

QUANTIZE