Atan and Atan2 (Arctan excel function)

Review of required concepts

Angle between x axis line (x=radius of circle,0) and the line passing through point on the circle can be measures in degree or Radians. Radian as measure is preferred by mathematician.

360 degrees is about 6.34 radians.



Excel trigonometric functions (Sin, Cos, Tan..), taken angle in Radian as an argument. 
Based on relation between angles in degree and Radian, one can convert degree to Randian and vice versa.




For Unit radius circle, x2 + y 2 = 1 (refer graph below, t is angle in radian)




Using Unit circle property, and trigonometric properties of sin and Cos function, 
You get x value (using Cos, of degree in Radian) and y value (using Sin, of degree in Radian).


Further, using Atan or Atan 2 you can get inverse of tangent, and can plot the points in 2 quadrant or 4 quadrant.

USING ATAN AND ATAN 2 FUNCTION

The ATAN function returns a result between -π/2 and π/2 radians (or -90 and 90 degrees), or in other words, in the first and fourth quadrants.


ATAN(number)
There is only one argument to ATAN: the number from which you want to calculate the inverse tangent. And since there is only one argument, Excel cannot determine which quadrant the solution should be in.

Values in the second (II) quadrant in column C are now in the fourth quadrant in column F.

Values in the third (III) quadrant in column C are now in the first quadrant in column F.

This is because, Excel calculates the value of y/x before if evaluates the ATAN function. It cannot determine, then, whether the input to ATAN is negative because the x-value or the y-value is negative.
Likewise, when the input value is positive, the original quadrant could be either the first (both x and y positive) or third (both x and y negative).

ATAN2 to help us out, use a complex nested IF function to get the results back into all four quadrants.

ATAN2(x_num,y_num)
This function returns a result between -π and π radians (or -180 and 180 degrees), using all four quadrants.

  • Quadrant 1 if both x and y are positive
  • Quadrant 2 if x is negative and y is positive
  • Quadrant 3 if both x and y are negative
  • Quadrant 4 if x is positive and y is negative


However, if we’d prefer to have the results in terms of an angle from 0 to 360 degrees rather than -180 to 180, we can use a simple IF function to add 360 if the result is less than 0.



Reference

https://engineerexcel.com/arctan-excel-atan-atan2/


https://nilkanthb.blogspot.com/2023/04/understanding-sin-cos-and-tan.html








Comments

Popular posts from this blog

Clear Understanding on Sin, Cos and Tan (Trigonometric Functions)

Clear Understanding on Mahalanobis Distance

Vignettes for Matrix concepts, related operations