Specifications
Section 8. Processing and Math Instructions
8-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
iN
=
=
=
∑
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.
Example
Public PTemp, TCTemp(5), RunAvgTC(5) 'Declare Public Variables
BeginProg
Scan(1,Sec,0,0) ‘Scan at 1 Hz
PanelTemp (PTemp,250)
TCDiff (TCTemp(),5,mV20,1,TypeT,PTemp,True ,0,250,1.0,0)
AvgRun (RunAvgTC(),5,TCTemp(),60)
NextScan
EndProg 'Program ends here
AvgSpa (Dest, Swath, Source)
Computes the spatial average of the values in the source array.
Syntax
AvgSpa (Dest, Swath, Source)