Avgrun (dest, reps, source, number) – Campbell Scientific CR5000 Measurement and Control Module User Manual
Page 178

Section 8. Processing and Math Instructions
8-6
Parameter
& Data Type
Enter
Dest
Variable
The variable in which to store the results of the instruction.
Swath
Constant
The number of values of the source array to average.
Source
Array
The name of the variable array that is the input for the instruction.
Average Spatial Output Example
This example uses AvgSpa to find the average value of the five elements
Temp(6) through Temp(10) and store the result in the variable AvgTemp.
AvgSpa(AvgTemp, 5, Temp(6))
AvgRun (Dest, Reps, Source, Number)
Calculates a running average of a measurement or calculated value.
Syntax
AvgRun (Dest, Reps, Source, Number)
Remarks
AvgRun is used to create a running average. A running average is the average
of the last N values where N is the number of values.
Dest
X
N
i
i
i N
=
=
=
∑
1
Where
X
N
is the most recent value of the source variable and
X
N
−
1
is the
previous value (
X
1
is the oldest value included in the average, i.e., N-1 values
back from the most recent).
Parameter
& Data Type
Enter
Dest
Variable or
Array
The variable or array in which to store the average(s).
Reps
Constant
When the source is an array, this is the number of variables in the array to
calculate averages for. When the source is not an array or only a single
variable of the array is to be averaged, reps should be 1.
Number
Constant
The number of values to include in the running average..
Source
Array
The name of the variable or array that is to be averaged.