# difference between "geodetic2aer" and "azimuth" function

1 view (last 30 days)
MatG on 28 Sep 2022
Answered: William Rose on 11 Nov 2022
What is the difference between the azimuth from "geodetic2aer" and "azimuth" functions in matlab?
In the following example, I set the first point latitude, logintude, and altitude as lat0, long0, and h0 and those of the second point as lat, long, and h. Using "geidetic2aer" gives an azimuth of 238.08 deg while using "azimuth" gives 237.99 deg. Are the azimuth returnd by these two functions supposed to be the same or am I missing something about their meaning? I know "azimuth" returns the angle for the great circle path.
wgs84 = wgs84Ellipsoid;
lat0 = 46.017;
lon0 = 7.750;
h0 = 1673;
lat = 45.977;
lon = 7.658;
h = 4531;
format shortG
[az,elev,slantRange] = geodetic2aer(lat,lon,h,lat0,lon0,h0,wgs84)
az1= azimuth(lat0,lon0,lat,lon)

William Rose on 11 Nov 2022
@MatG, azimuth, by default, assumes the Earth is a sphere. geodetic2aer() ias using wgs84 spheroid, in your usage. If you tell azimuth to use wgs84, they give the same result.
wgs84 = wgs84Ellipsoid;
lat0 = 46.017;
lon0 = 7.750;
h0 = 1673;
lat = 45.977;
lon = 7.658;
h = 4531;
format shortG
[az,elev,slantRange] = geodetic2aer(lat,lon,h,lat0,lon0,h0,wgs84);
az1= azimuth(lat0,lon0,lat,lon,wgs84);
fprintf('geodetic2aer: az=%.2f. azimuth(): az=%.2f.\n',az,az1);
geodetic2aer: az=238.08. azimuth(): az=238.08.
Try it.

### Categories

Find more on Coordinate Systems in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!