Specifications

Section 8. Processing and Math Instructions
8-7
Remarks
Find the average of the values in the given array and place the result in the
variable named in Dest. The Source must be a particular element in an array
(e.g., Temp(1)); it is the first element in the array to include in the average.
The Swath is the number of elements to include in the average.
Dest
Xi
s
wath
ij
ijswath
=
=
=
+
()
Where X(j) = Source
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))
COS (Angle)
Returns the cosine of an angle specified in radians.
Syntax
x = COS (angle)
Remarks
Angle can be any valid numeric expression measured in radians.
The COS function takes an angle and returns the ratio of two sides of a right
triangle. The ratio is the length of the side adjacent to the angle divided by the
length of the hypotenuse. The result lies in the range -1 to 1.
To convert degrees to radians, multiply degrees by π/180. To convert radians
to degrees, multiply radians by 180/π.
COS Function Example
The example uses COS to calculate the cosine of an angle with a user-specified
number of degrees.
Dim Degrees, Pi, Radians, Ans 'Declare variables.
BeginProg
Pi = 4 * Atn(1) 'Calculate Pi.
Degrees = Volts(1) 'Get value to convert.
Radians = Degrees * (Pi / 180) 'Convert to radians.
Ans = COS(Radians) ‘The Cosine of Degrees.
EndProg