Convert geodetic to geocentric (ECEF) coordinates
[x,y,z] = geodetic2ecef(phi,lambda,h,ellipsoid)
[x,y,z] = geodetic2ecef(phi,lambda,h,ellipsoid) converts geodetic point locations specified by the coordinate arrays phi (geodetic latitude in radians), lambda (longitude in radians), and h (ellipsoidal height) to geocentric Cartesian coordinates x, y, and z. ellipsoid is a referenceEllipsoid (oblateSpheroid) object, a referenceSphere object, or a vector of the form [semimajor axis, eccentricity]. h must use the same units as the semimajor axis; x, y, and z will be expressed in these units, also.
The geocentric Cartesian coordinate system is fixed with respect to the Earth, with its origin at the center of the ellipsoid and its x-, y-, and z-axes intersecting the surface at the locations listed in the table below.
|Axis||Latitude where axis intersects surface||Longitude where axis intersects surface||Description|
|y||0||90º E||Equator/90º E meridian|
|z||90º N||NA||North Pole|
A common synonym is Earth-Centered, Earth-Fixed coordinates, or ECEF.