FAQ/atan - CBU statistics Wiki

Clear message
location: FAQ / atan

# Computing arctans in EXCEL

There are two functions which compute arc tangents (which computes the angle expressed in radians) of a line going from the origin to a co-ordinates in arrays X,Y.

Syntax:

P = atan2(Y,X) or P = atan(X/Y)

P = atan2(Y,X) returns an array P the same size as X and Y containing the element-by-element, four-quadrant inverse tangent (arctangent) of the real parts of Y and X. Any imaginary parts of the inputs are ignored.

Elements of P lie in the closed interval [-pi,pi], where pi is the MATLAB floating-point representation of $$\pi$$. atan uses sign(Y) and sign(X) to determine the specific quadrant.

atan2(Y,X) contrasts with atan(Y/X), whose results are limited to the interval [-pi/2, pi/2].