beautypg.com

Sin(source), Sinh (source), Sortspa (dest, swath, source) – Campbell Scientific CR9000X Measurement and Control System User Manual

Page 320: Syntax

background image

Section 8. Processing and Math Instructions

SIN(Source)

SIN returns the sine of an angle.

Syntax

SIN(source)

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.

If it is desired to use degrees

instead of radians for the inputs and results of the trig functions in a program,
the "AngleDegrees" declaration instruction can be used.

To convert degrees to radians, multiply degrees by

π

/180. To convert radians to

degrees, multiply radians by 180/

π

.

π

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

π

.

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
Return = SINH( X )

Remarks
The SINH function returns the hyperbolic sine [ SINH(x) = 0.5( e

x

- 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

SortSpa (Dest, Swath, Source)

The SortSpa function is used to sort the elements of an array in ascending
order.

Syntax

SortSpa(

Dest, Swath, Source

)

8-34