Main Content

enu2ecef

Transform local east-north-up coordinates to geocentric Earth-centered Earth-fixed

Description

example

[X,Y,Z] = enu2ecef(xEast,yNorth,zUp,lat0,lon0,h0,spheroid) transforms the local east-north-up (ENU) Cartesian coordinates specified by xEast, yNorth, and zUp to the geocentric Earth-centered Earth-fixed (ECEF) Cartesian coordinates specified by X, Y, and Z. Specify the origin of the local ENU system with the geodetic coordinates lat0, lon0, and h0. Each coordinate input argument must match the others in size or be scalar. Specify spheroid as the reference spheroid for the geodetic coordinates.

[___] = enu2ecef(___,angleUnit) specifies the units for latitude and longitude. Specify angleUnit as 'degrees' (the default) or 'radians'.

Examples

collapse all

Find the ECEF coordinates of orbital debris, using the ENU coordinates of the debris relative to the geodetic coordinates of a satellite.

First, specify the reference spheroid as WGS84 with length units measured in kilometers. For more information about WGS84, see Comparison of Reference Spheroids. The units for the ellipsoidal height, ENU coordinates, and ECEF 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 satellite. Specify h0 as ellipsoidal height in kilometers.

lat0 = 45.9132;
lon0 = 36.7484;
h0 = 1877.7532;

Specify the ENU coordinates of the point of interest. In this example, the point of interest is the orbital debris.

xEast = 355.6013;
yNorth = -923.0832;
zUp = 1041.0164;

Then, calculate the ECEF coordinates of the debris. In this example, the results display in scientific notation.

[x,y,z] = enu2ecef(xEast,yNorth,zUp,lat0,lon0,h0,wgs84)
x = 5.5075e+03
y = 4.5562e+03
z = 6.0128e+03

Reverse the transformation using the ecef2enu function. In this example, zUp displays in scientific notation.

[xEast,yNorth,zUp] = ecef2enu(x,y,z,lat0,lon0,h0,wgs84)
xEast = 355.6013
yNorth = -923.0832
zUp = 1.0410e+03

Input Arguments

collapse all

ENU x-coordinates of one or more points in the local ENU system, specified as a scalar, vector, matrix, or N-D array. Specify values in units that match the LengthUnit property of the spheroid argument. For example, the default length unit for the reference ellipsoid created by wgs84Ellipsoid is 'meter'.

Data Types: single | double

ENU y-coordinates of one or more points in the local ENU system, specified as a scalar, vector, matrix, or N-D array. Specify values in units that match the LengthUnit property of the spheroid argument. For example, the default length unit for the reference ellipsoid created by wgs84Ellipsoid is 'meter'.

Data Types: single | double

ENU z-coordinates of one or more points in the local ENU system, specified as a scalar, vector, matrix, or N-D array. Specify values in units that match the LengthUnit property of the spheroid argument. For example, the default length unit for the reference ellipsoid created by wgs84Ellipsoid is 'meter'.

Data Types: single | double

Geodetic latitude of the local origin, specified as a scalar, vector, matrix, or N-D array. The local origin can refer to one point or a series of points (for example, a moving platform). Specify the values in degrees. To use values in radians, specify the angleUnit argument as 'radians'.

Data Types: single | double

Geodetic longitude of the local origin, specified as a scalar, vector, matrix, or N-D array. The local origin can refer to one point or a series of points (for example, a moving platform). Specify the values in degrees. To use values in radians, specify the angleUnit argument as 'radians'.

Data Types: single | double

Ellipsoidal height of the local origin, specified as a scalar, vector, matrix, or N-D array. The local origin can refer to one point or a series of points (for example, a moving platform). Specify values in units that match the LengthUnit property of the spheroid object. For example, the default length unit for the reference ellipsoid created by wgs84Ellipsoid is 'meter'.

For more information about ellipsoidal height, see Find Ellipsoidal Height from Orthometric Height.

Data Types: single | double

Reference spheroid, specified as a referenceEllipsoid object, oblateSpheroid object, or referenceSphere object. The term reference spheroid is used synonymously with reference ellipsoid. To create a reference spheroid, use the creation function for the object. To specify the reference ellipsoid for WGS84, use the wgs84Ellipsoid function.

For more information about reference spheroids, see Comparison of Reference Spheroids.

Example: spheroid = referenceEllipsoid('GRS 80');

Angle units, specified as 'degrees' (the default) or 'radians'.

Output Arguments

collapse all

ECEF x-coordinates of one or more points in the geocentric ECEF system, returned as a scalar, vector, matrix, or N-D array. Units are specified by the LengthUnit property of the spheroid argument. For example, the default length unit for the reference ellipsoid created by wgs84Ellipsoid is 'meter'.

ECEF y-coordinates of one or more points in the geocentric ECEF system, returned as a scalar, vector, matrix, or N-D array. Units are specified by the LengthUnit property of the spheroid argument. For example, the default length unit for the reference ellipsoid created by wgs84Ellipsoid is 'meter'.

ECEF z-coordinates of one or more points in the geocentric ECEF system, returned as a scalar, vector, matrix, or N-D array. Units are specified by the LengthUnit property of the spheroid argument. For example, the default length unit for the reference ellipsoid created by wgs84Ellipsoid is 'meter'.

Tips

To transform vectors instead of coordinate locations, use the enu2ecefv function.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2012b

expand all