Transform geocentric Earth-centered Earth-fixed coordinates to local north-east-down
transforms the geocentric Earth-centered Earth-fixed (ECEF) Cartesian coordinates
Z to the local north-east-down (NED) Cartesian coordinates
zDown. Specify the origin of the local NED system with the
h0. Each coordinate input argument must match the others in
size or be scalar. Specify
spheroid as the reference spheroid
for the geodetic coordinates.
[___] = ecef2ned(___,
specifies the units for latitude and longitude. Specify
'degrees' (the default) or
Calculate NED Coordinates from ECEF Coordinates
Find the NED coordinates of Mount Mansfield with respect to a nearby aircraft, using the ECEF coordinates of Mount Mansfield and the geodetic coordinates of the aircraft.
First, specify the reference spheroid as WGS84 with length units measured in kilometers. For more information about WGS84, see Reference Spheroids. The units for the ellipsoidal height, ECEF coordinates, and NED coordinates must match the units specified by the
LengthUnit property of the reference spheroid.
wgs84 = wgs84Ellipsoid('kilometer');
Specify the geodetic coordinates of the local origin. In this example, the local origin is the aircraft. Specify
h0 as ellipsoidal height in kilometers.
lat0 = 44.532; lon0 = -72.782; h0 = 1.699;
Specify the ECEF coordinates of the point of interest. In this example, the point of interest is Mount Mansfield.
x = 1345.660; y = -4350.891; z = 4452.314;
Then, calculate the NED coordinates of Mount Mansfield with respect to the aircraft. Since the ellipsoidal height of the aircraft is greater than the height of Mount Mansfield, a passenger needs to look down to see the mountaintop. The z-axis of an NED coordinate system points down. Thus, the value of
zDown is positive.
[xNorth,yEast,zDown] = ecef2ned(x,y,z,lat0,lon0,h0,wgs84)
xNorth = 1.3343
yEast = -2.5444
zDown = 0.3600
Reverse the transformation using the
ned2ecef function. In this example, the results display in scientific notation.
[x,y,z] = ned2ecef(xNorth,yEast,zDown,lat0,lon0,h0,wgs84)
x = 1.3457e+03
y = -4.3509e+03
z = 4.4523e+03
To transform vectors instead of coordinate locations, use the
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version HistoryIntroduced in R2012b
R2021a: Generate C and C++ code using MATLAB Coder
ecef2ned function supports code generation.