ecef2aer
Transform geocentric Earth-centered Earth-fixed coordinates to local spherical
Description
[
transforms the geocentric Earth-centered Earth-fixed (ECEF) Cartesian coordinates
specified by az
,elev
,slantRange
]
= ecef2aer(X
,Y
,Z
,lat0
,lon0
,h0
,spheroid
)X
, Y
, and
Z
to the local azimuth-elevation-range (AER) spherical
coordinates specified by az
, elev
, and
slantRange
. Specify the origin of the local AER 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.
[___] = ecef2aer(___,
specifies the units for latitude, longitude, azimuth, and elevation. Specify
angleUnit
)angleUnit
as 'degrees'
(the default) or
'radians'
.
Examples
Calculate AER Coordinates from ECEF Coordinates
Find the AER coordinates of a satellite with respect to a satellite dish, using the ECEF coordinates of the satellite and the geodetic coordinates of the satellite dish.
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, slant range, and ECEF coordinates must match the units specified by the LengthUnit
property of the reference spheroid.
wgs84 = wgs84Ellipsoid('kilometers');
Specify the geodetic coordinates of the local origin. In this example, the local origin is the satellite dish. Specify h0
as ellipsoidal height in kilometers.
lat0 = 42.3221; lon0 = -71.3576; h0 = 0.0847;
Specify the ECEF coordinates of the point of interest. In this example, the point of interest is the satellite.
x = 10766.0803; y = 14143.6070; z = 33992.3880;
Then, calculate the AER coordinates of the satellite with respect to the satellite dish. In this example, slantRange
displays in scientific notation.
[az,elev,slantRange] = ecef2aer(x,y,z,lat0,lon0,h0,wgs84)
az = 24.8012
elev = 14.6185
slantRange = 3.6272e+04
Reverse the transformation using the aer2ecef
function. In this example, the results display in scientific notation.
[x,y,z] = aer2ecef(az,elev,slantRange,lat0,lon0,h0,wgs84)
x = 1.0766e+04
y = 1.4144e+04
z = 3.3992e+04
Input Arguments
X
— ECEF x-coordinates
scalar | vector | matrix | N-D array
ECEF x-coordinates of one or more points in the geocentric ECEF 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
Y
— ECEF y-coordinates
scalar | vector | matrix | N-D array
ECEF y-coordinates of one or more points in the geocentric ECEF 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
Z
— ECEF z-coordinates
scalar | vector | matrix | N-D array
ECEF z-coordinates of one or more points in the geocentric ECEF 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
lat0
— Geodetic latitude of local origin
scalar | vector | matrix | N-D array
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
lon0
— Geodetic longitude of local origin
scalar | vector | matrix | N-D array
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
h0
— Ellipsoidal height of local origin
scalar | vector | matrix | N-D array
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
spheroid
— Reference spheroid
referenceEllipsoid
object | oblateSpheroid
object | referenceSphere
object
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');
angleUnit
— Angle units
'degrees'
(default) | 'radians'
Angle units, specified as 'degrees'
(the default) or
'radians'
.
Output Arguments
az
— Azimuth angles
scalar | vector | matrix | N-D array
Azimuth angles of one or more points in the local AER system, returned as a scalar,
vector, matrix, or N-D array. Azimuths are measured clockwise from north. Values are
specified in degrees within the half-open interval [0 360). To use values in radians, specify the angleUnit
argument as 'radians'
.
elev
— Elevation angles
scalar | vector | matrix | N-D array
Elevation angles of one or more points in the local AER system, returned
as a scalar, vector, matrix, or N-D array. Elevations are measured with
respect to a plane that is perpendicular to the normal of the spheroid
surface. If the local origin is on the surface of the spheroid (h0
= 0
), then the plane is tangent to the spheroid.
Values are specified in degrees within the closed interval [-90 90]. To use values in radians, specify the
angleUnit
argument as
'radians'
.
slantRange
— Distances from local origin
scalar | vector | matrix | N-D array
Distances from the local origin, returned as a scalar, vector, matrix, or N-D array.
Each distance is calculated along a straight, 3-D, Cartesian line. 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'
.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2012bR2021a: Generate C and C++ code using MATLAB Coder
The ecef2aer
function supports code generation.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)