Accelerating the pace of engineering and science

# elevation

Local vertical elevation angle, range, and azimuth

 Note:   elevation will be removed in a future release. Use geodetic2aer instead. The reference point comes second in the geodetic2aer argument list, and the outputs are ordered differently. The replacement pattern is: [azimuthangle, elevationangle, slantrange] = geodetic2aer(lat2, lon2, alt2, lat1, lon1, alt1, spheroid, ...) Unlike elevation, geodetic2aer requires a spheroid input, and it must be must be an oblateSpheroid, referenceEllipsoid, or referenceSphere object, not a 2-by-1 ellipsoid vector. You can use the following steps to convert an ellipsoid vector, ellipsoid, to an oblateSpheroid object, spheroid: spheroid = oblateSpheroid;spheroid.SemimajorAxis = ellipsoid(1);spheroid.Eccentricity = ellipsoid(2);When elevation is called with only 6 inputs, the GRS 80 reference ellipsoid, in meters, is used by default. To replace this usage, use referenceEllipsoid('GRS80','meters') as the spheroid input for geodetic2aer. If an angleunits input is included, it must follow the spheroid input in the call to geodetic2aer, rather than preceding it.elevation can be called with a lengthunits string, but geodetic2aer has no such input. Set the LengthUnit property of the input spheroid to the desired value instead. In this case a referenceEllipsoid or referenceSphere object must be used (not an oblateSpheroid object).

## Syntax

[elevationangle,slantrange,azimuthangle] = ...
elevation(lat1,lon1,alt1,lat2,lon2,alt2)
[...] = elevation(lat1,lon1,alt1,lat2,lon2,alt2,...
angleunits)
[...] = elevation(lat1,lon1,alt1,lat2,lon2,alt2,...
angleunits,distanceunits)
[...] = elevation(lat1,lon1,alt1,lat2,lon2,alt2,...
angleunits,ellipsoid)

## Description

[elevationangle,slantrange,azimuthangle] = ...
elevation(lat1,lon1,alt1,lat2,lon2,alt2)
computes the elevation angle, slant range, and azimuth angle of point 2 (with geodetic coordinates lat2, lon2, and alt2) as viewed from point 1 (with geodetic coordinates lat1, lon1, and alt1). The coordinates alt1 and alt2 are ellipsoidal heights. The elevation angle is the angle of the line of sight above the local horizontal at point 1. The slant range is the three-dimensional Cartesian distance between point 1 and point 2. The azimuth is the angle from north to the projection of the line of sight on the local horizontal. Angles are in units of degrees; altitudes and distances are in meters. The figure of the earth is the default ellipsoid (GRS 80).

Inputs can be vectors of points, or arrays of any shape, but must match in size, with the following exception: Elevation, range, and azimuth from a single point to a set of points can be computed very efficiently by providing scalar coordinate inputs for point 1 and vectors or arrays for point 2.

[...] = elevation(lat1,lon1,alt1,lat2,lon2,alt2,...
angleunits)
uses the string angleunits to specify the units of the input and output angles. If the string angleunits is omitted, 'degrees' is assumed.

[...] = elevation(lat1,lon1,alt1,lat2,lon2,alt2,...
angleunits,distanceunits)
uses the string distanceunits to specify the altitude and slant-range units. If the string distanceunits is omitted, 'meters' is assumed. Any units string recognized by unitsratio may be used.

[...] = elevation(lat1,lon1,alt1,lat2,lon2,alt2,...
angleunits,ellipsoid)
uses ellipsoid to specify the ellipsoid. ellipsoid is a referenceSphere, referenceEllipsoid, or oblateSpheroid object, or a vector of the form [semimajor_axis eccentricity]. If ellipsoid is supplied, the altitudes must be in the same units as the semimajor axis, and the slant range will be returned in these units. If ellipsoid is omitted, the default is a unit sphere. Distances are in meters unless otherwise specified.

 Note   The line-of-sight azimuth angles returned by elevation will generally differ slightly from the corresponding outputs of azimuth and distance, except for great circle azimuths on a spherical earth.

## Examples

Find the elevation angle of a point 90 degrees from an observer assuming that the observer and the target are both 1000 km above the Earth.

```lat1 = 0; lon1 = 0; alt1 = 1000*1000;
lat2 = 0; lon2 = 90; alt2 = 1000*1000;
elevang = elevation(lat1,lon1,alt1,lat2,lon2,alt2)

elevang =
-45```

Visually check the result using the los2 line of sight function. Construct a data grid of zeros to represent the Earth's surface. The los2 function with no output arguments creates a figure displaying the geometry.

```Z = zeros(180,360);
refvec = [1 90 -180];
los2(Z,refvec,lat1,lon1,lat2,lon2,alt1,alt1);```