Sinh (source), Sqr (source) – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 202

Advertising
background image

Section 8. Processing and Math Instructions

8-30

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

π

/180. To convert radians

to degrees, multiply radians by 180/

π

.

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.

SinH (Source)

The SINH function returns the hyperbolic sine of an expression or value.

Syntax
x = SINH( Expr )

Remarks
The SINH function returns the hyperbolic sine [ SINH(x) = 0.5( ex - e-x ) ] for
the value contained in the Expr argument.

The example uses SINH to calculate the hyperbolic sine of a voltage input.

Public Volt1, Ans

'Declare variables.

BeginProg
Scan ( 1, min, 3, 0)

VoltDiff(Volt1,1,mV5000,1,True,100,500,1,0)
'Returns voltage on Channel(1) to Volt(1)
Ans = SINH( Volt1 ) 'The Hyperbolic Sine of Volt1.
NextScan

EndProg

Sqr (Source)

Returns the square root of a number.

Syntax
x = 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.

Advertising