wrong value from atan2 function in excel

0

1

I am trying to calculate the angle between two latitudes and longitudes but I am getting wrong result of atan2(X,Y) when used on Excel.

β = atan2(X,Y) = atan2(0.05967668696, -0.00681261948)

It should be 1.68radian (96.51°) but on excel it is showing -0.113666736 (-6.512624235°)

β = atan2(X,Y),

where, X and Y are two quantities and can be calculated as:

  • X = cos θb * sin ∆L
  • Y = cos θa * sin θb – sin θa * cos θb * cos ∆L

    Latitude/Longitude(1): (Lat1,Lon1)= 39.099912, -94.581213

    Latitude/Longitude(2): (Lat2,Lon2)= 38.627089, -90.200203

    ‘L’            be the longitude,
    ‘∆L=lon2-lon1’ be the difference of longitude,
    ‘θ’            be latitude,
    ‘β‘            be Bearing
    

Fahadkalis

Posted 2015-08-03T17:36:07.557

Reputation: 113

Not sure if you're aware, but there is a mathematica.se - also my atan2() is giving me -0.11367 - so you're converting it to degrees, which you didn't indicate.

– Raystafarian – 2015-08-03T18:04:00.023

yes you are right, I am converting it in degree after using atan2(x,y).. – Fahadkalis – 2015-08-03T18:10:05.837

that's the same formula I am using – Fahadkalis – 2015-08-03T18:24:26.010

Answers

0

  1. There is nothing wrong with atan2(X,Y) function in Excel: the point you have specified '(0.05967668696, -0.00681261948)' lies in the fourth quadrant, i.e. its angle is really '-6.51°'.

  2. But if you want calculate an 'absolute' value of angle between two geographical points, you should use and absolute difference between coordinates:

      β=ATAN2(ABS(0.05967668696), ABS(-0.00681261948))
    
  3. Bear in mind that if this calculation is on a sphere (Earth), it is an approximation because of circular triangle. It is OK for small angles.

Aleksandar

Posted 2015-08-03T17:36:07.557

Reputation: 27