MOMENT Function

Standard Library function that computes moments of an array.

Usage

    result = MOMENT(a, i)

Input Parameters

a—An array of n dimensions.

i—A vector of n non-negative real numbers defining moment order.

Returned Value

result—A scalar double equal to:

Keywords

None.

Examples

a = BYTARR(600, 500)
x = INDEX_CONV(a, LINDGEN(N_ELEMENTS(a)))
a(WHERE((x(*, 0) - 200)^2 + (x(*, 1) - 300)^2 LT 100^2)) = 255
TV, a
CENTROID = [MOMENT(a, [1, 0]), MOMENT(a, [0, 1])] / $
            MOMENT(a, [0, 0])
PLOTS, CENTROID, /Device, Color=0, PSYM=2