Section 8. Processing and Math Instructions
8-24
Sine Function
Returns the sine of an angle.
Syntax
Sin(
angle
)
Remarks
The argument
angle
can be any valid numeric expression measured in radians.
The
Sin
function takes an
angle
and returns the ratio of two sides of a right triangle.
The ratio is the length of the side opposite 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 Pi/180. To convert radians to
degrees, multiply radians by 180/Pi. Pi is approximately 3.141593.
Returns the sine of the value in parentheses. The input must be in radians.
Sin Function Example
The example uses Sin to calculate the sine of an angle from a Volt input.
Dim Degrees, Pi, Radians, Ans
'Declare variables.
Pi = 4 * Atn(1)
'Calculate Pi.
Degrees = Volt(1)
'Get input.
Radians = Degrees * (Pi / 180)
'Convert to radians.
Ans =
Sin(
Radians
)
‘The Sine of Degrees.
Sqr Function
Returns the square root of a
number
.
Syntax
Sqr(
number
)
Remarks
The argument
number
can be any valid numeric expression that results in a value
greater than or equal to 0.
Returns the square root of the value in parentheses.
Sqr Function Example
The example uses Sqr to calculate the square root of Volt(1) value.
Dim Msg, Number
'Declare variables.
Number = Volt(1)
'Get input.
If Number < 0 Then
Msg = 0
‘Cannot determine the square root of a negative number.
Else
Msg
=
Sqr(
Number
)
End If
Содержание CR9000
Страница 6: ...CR9000 Table of Contents iv This is a blank page ...
Страница 22: ...CR9000 Overview OV 16 This is a blank page ...
Страница 26: ...Section 1 Installation 1 4 CR9000 FIGURE 1 1 3 CR9000 Battery Pack ...
Страница 72: ...Section 3 CR9000 Measurement Details 3 28 This is a blank page ...
Страница 88: ...Section 5 Program Declarations 5 6 This is a blank page ...
Страница 217: ...This is a blank page ...