# geodetic2aer elevation and range calculation

6 views (last 30 days)
michael on 4 Jul 2022
Hi,
I'd like to calculate an elevation and a range from a known point on earth to a plane flying at distanse 200Km.
Our calculation using following formulas:
% p1.alt, p2.alt - highth above earth + earth radius (6378138 m)
% assumtoin is that earth is sphere with same radius.
alpha=acos(sin(p1.lat)*sin(p2.lat)+cos(p1.lat)*cos(p2.lat)*cos(p2.long-p1.long)) % Earth Central Angle
SlantRange=sqrt(p1.alt.^2 + p2.alt.^2-2*p1.alt*p2.alt*cos(alpha)) %cosine law.
elevation=acos(p1.alt.^2 + SlantRange.^2 -p2.alt.^2)/(2*SlantRange*p1.alt)
Plotting the 2 graphs I can see that the results are same more or less, but when doing the zoom-in, while a plane is at 120Km distanse (for example), I can see that there is diffrenece between my code and result of geodetic2aer by ~500m and elevation of 1 degree!
Digging into the code of geodetic2aer, I can see that some part of the geodetic2aer is using a Pythagorean theorem, but it is also uses semimahor axis and semiminor axis valeus.
So my question is - is there some assumtions which are taken into account for the geodetic2aer?
Which is more correct? (Myabe none of the 2 is correct and needs to use other formula to get the exact value).

### Categories

Find more on Vehicle Scenarios in Help Center and File Exchange

R2022a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!