Atn (source), Atn2() – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 176

Advertising
background image

Section 8. Processing and Math Instructions

8-4

ATN (Source)

Returns the arctangent of a number.

Syntax
x = ATN (
source)

Remarks
Source can be any valid numeric expression.

The Atn function takes the ratio of two sides of a right triangle and returns the
corresponding angle. The ratio is the length of the side opposite the angle
divided by the length of the side adjacent to the angle. The result is expressed
in radians and is in the range -

π

/2 to

π

/2 radians.

To convert degrees to radians, multiply degrees by

π

/180. To convert radians

to degrees, multiply radians by 180/

π

.

Atn is the inverse trigonometric function of Tan, which takes an angle as its
argument and returns the ratio of two sides of a right triangle. Do not confuse
Atn with the cotangent, which is the simple inverse of a tangent (1/tangent).

Atn FunctionExample

The example uses Atn to calculate

π

. By definition, a full circle is 2

π

radians.

Atn(1) is

π

/4 radians (45 degrees).

Dim Pi

'Declare variables.

Pi = 4 * Atn(1)

'Calculate Pi.

ATN2()

The ATN2 function returns the arctangent of y/x.

Syntax
x = ATN2
( Y, X )

Remarks
ATN2 function calculates the arctangent of Y/X returning a value in the range
from Pi to -Pi radians, using the signs of both parameters to determine the
quadrant of the return value. ATN2 is defined for every point other than the
origin (X = 0 and Y = 0). Y and X can be variables, constants, or expressions.

To convert degrees to radians, multiply degrees by

π

/180. To convert radians

to degrees, multiply radians by 180/

π

.

Advertising