Main Content

lla2ecef

Convert geodetic coordinates to Earth-centered Earth-fixed (ECEF) coordinates

Description

example

ecef = lla2ecef(lla) converts an m-by-3 array of geodetic coordinates (latitude, longitude and altitude), lla, to an m-by-3 array of ECEF coordinates, ecef.

ecef = lla2ecef(lla,model) converts the coordinates for a specific ellipsoid planet.

ecef = lla2ecef(lla,f,Re) converts the coordinates for a custom ellipsoid planet defined by flattening, f, and the equatorial radius, Re, in meters.

Examples

collapse all

Determine ECEF coordinates at a latitude, longitude, and altitude:

p = lla2ecef([0 45 1000])
p =
   1.0e+06 *

    4.5107    4.5107         0

Determine ECEF coordinates at multiple latitudes, longitudes, and altitudes using the WGS84 ellipsoid model:

p = lla2ecef([0 45 1000; 45 90 2000], 'WGS84')
p =
   1.0e+06 *

    4.5107    4.5107         0
         0    4.5190    4.4888

Determine ECEF coordinates at multiple latitudes, longitudes, and altitudes using the custom ellipsoid model:

f = 1/196.877360;
Re = 3397000;
p = lla2ecef([0 45 1000; 45 90 2000], f, Re)
p =
   1.0e+06 *

    2.4027    2.4027         0
         0    2.4096    2.3852

Input Arguments

collapse all

Geodetic coordinates (latitude, longitude and altitude), specified as an m-by-3 array in [degrees degrees meters]. Latitude and longitude values can be any value. However, latitude values of +90 and -90 may return unexpected values because of singularity at the poles. Altitude is above the planetary ellipsoid.

Data Types: double

Ellipsoid planet model, specified as 'WGS84'.

Data Types: char | string

Flattening at each pole, specified as a scalar.

Data Types: double

Equatorial radius, specified as a scalar, in meters.

Data Types: double

Output Arguments

collapse all

ECEF coordinates, returned as an m-by-3 array of ECEF coordinates.

Introduced in R2006b