Mean

(Engine-Level Function)

Description Returns the mean (average) of a portion of a numerical array.
Returns Numeric
Usage Script or steady state.
Function Groups Array,  Generic Math
Related to: AMax | AMin | AValid | FiltHigh | FiltLow | FitOffset | FitSlope | SDev | Sum | Variance
Format: Mean(ArrayStart, N)
Parameters  
ArrayStart
Required. Any numeric array element giving the starting element of the array. The index for the array may be any numeric expression and specifies the starting point for the array search. If processing a multi-dimensional array, the usual rules apply to decide which dimension should be examined.
N
Required. Any numeric expression giving the number of array elements to use starting at the element given by the first parameter. If N extends past the upper bound of the lowest array dimension, this computation will "wrap-around" and resume at element 0, until N elements have been processed.
Comments Invalid array elements are not included as part of the calculation, unless there are no valid numerical array elements in the specified range, in which case the function returns invalid. Invalid is also returned if either parameter is invalid, or if the number of elements to use is 0.

Example:

x[0] = Invalid;
x[1] = Invalid;
x[2] = Invalid;
x[3] = 1;
x[4] = 2;
x[5] = 1;
x[6] = 2;
avg = Mean(x[0], 7);

The value of avg will be set to 1.5.