# aer

Calculate azimuth angle, elevation angle, and range of another satellite or ground station in NED frame

Since R2021a

## Syntax

``az = aer(asset,target)``
``[az,el] = aer(asset,target)``
``[az,el,range] = aer(asset,target)``
``[az,el,range,timeOut] = aer(asset,target)``
``[___] = aer(asset,target,timeIn)``
``[___] = aer(___,coordinateFrame='ned')``

## Description

````az = aer(asset,target)` returns a 2-D array of the history of azimuth angles `az`, between `asset` and `target` belonging to a given `satelliteScenario` object.```
````[az,el] = aer(asset,target)` returns the history of elevation angles, `el`, between satellite or ground station `asset` and another satellite or ground station `target`.```

example

````[az,el,range] = aer(asset,target)` returns row vectors of the history of the `range` of `Satellite` or `GroundStation` in `target` with respect to those in `asset`.```
````[az,el,range,timeOut] = aer(asset,target)` returns the corresponding time in `timeOut`.```
````[___] = aer(asset,target,timeIn)` returns the outputs at the specified datetime `timeIn`. `az`, `el`, and `range` are structured the same way as described in syntaxes with an exception that the size of the second dimension is fixed at 1, representing the values at the specified time `timeIn`.```
````[___] = aer(___,coordinateFrame='ned')` returns the `az`, `el`, `range`, and `timeOut` based on the specified output arguments and the coordinate frame defined by the name-value argument. NoteBy default, the `aer` function uses the north-east-down (NED) system to perform all the calculations. ```

## Examples

collapse all

Create a satellite scenario object.

```startTime = datetime(2021,4,25); % April 25, 2021, 12:00 AM UTC stopTime = datetime(2021,4,26); % April 26, 2021, 12:00 AM UTC sampleTime = 60; % seconds sc = satelliteScenario(startTime,stopTime,sampleTime);```

Add a satellite to the scenario.

```tleFile = "eccentricOrbitSatellite.tle"; sat = satellite(sc,tleFile);```

Add a ground station to the scenario using default properties.

`gs = groundStation(sc);`

Determine the azimuth angle, elevation angle, and range of the ground station with respect to the satellite at April 25, 2021, 1:26 AM UTC.

```time = datetime(2021,4,25,1,26,0); [azimuth,elevation,range] = aer(sat,gs,time)```
```azimuth = 15.2962 ```
```elevation = -70.3858 ```
```range = 1.3442e+07 ```

## Input Arguments

collapse all

Time at which output is calculated, specified as a datetime. If no time zone is specified in `timeIn`, the time zone is assumed to be UTC.

Coordinate frame, specified as either `'ned'` or `'body'`.

• When `coordinateFrame` is `'ned'` — The azimuth angle is defined in the North-East-Down (NED) frame of (and centered at) `asset` such that 0 degrees is North, 90 degrees is East, 180 degrees is South, and 270 degrees is West. The elevation angle is defined in the NED frame of (and centered at) `asset` such that 0 degrees implies `target` is on the North East (NE) plane, 90 degrees implies `target` is directly above `asset`, and -90 degrees implies `target` is directly below `asset`.

• When `coordinateFrame` is `'body'` — The azimuth angle is the angle between the projection of the relative position vector of `target` on the x-y plane of the body frame of `asset`, and the x-axis of `asset`. The angle is positive for positive (clockwise) rotation about the z-axis of `asset`. The elevation angle is the angle between the relative position vector of `target` on the x-y plane of the body frame of `asset`. The angle is positive when the z component of the relative position of `target` defined in the body frame of `asset` is negative.

## Output Arguments

collapse all

Azimuth angles of the target in the local azimuth, elevation, and range (AER) system in degrees, returned as a vector, 2-D array, or scalar in the range [0,360). Azimuths are measured clockwise from North. If the `timeIn` argument is not specified, the vector elements correspond to the time samples specified by the `SampleTime` property from the satellite scenario `StartTime` to `StopTime`.

• If both `asset` and `target` are scalars, `az` is a row vector where each element represents the azimuth angle of `target` with respect to `asset` in the NED frame of `asset` at a specified time sample.

• If `asset` is a scalar and `target` is a vector, `az` is a 2-D array, where each row represents the azimuth angle of each element in `target` with respect to `asset` in the NED frame of `asset` and the columns represent the time samples.

• If `asset` is a vector and `target` is a scalar, `az` is a 2-D array, where each row represents the azimuth angle of `target` with respect to each element in `asset` in the NED frame of the element in `asset` and the columns represent the time samples.

• If both `asset` and `target` are vectors, the length of `asset` must equal the length of `target`. The `az` is a 2-D array, where each row index corresponds to the index in `asset` and `target`, and represents the azimuth angle of the element at the index in `target` with respect to the element at the index in `asset` in the NED frame of that element in `asset`. The columns represent the time samples.

If the `timeIn` argument is not specified and when the `AutoSimulate` property of the satellite scenario is `true`, aer function returns the `az` history from `StartTime` to `StopTime`. Otherwise, it returns the `az` history from `StartTime` to `SimulationTime`.

Elevation angles of target in the local AER system in degrees, returned as a vector, 2-D array, or scalar in the range [-90 90]. Elevations are measured with respect to a plane that is perpendicular to the normal of the surface of the earth. If `asset` is on the surface of the Earth, then the plane is tangential to the Earth. If the `timeIn` argument is not specified, the vector elements correspond to the time samples specified by the `SampleTime` property from the satellite scenario `StartTime` to `StopTime`.

If the `timeIn` argument is not specified and when the `AutoSimulate` property of the satellite scenario is `true`, aer function returns the `el` history from `StartTime` to `StopTime`. Otherwise, it returns the `el` history from `StartTime` to `SimulationTime`.

Distances from the local origin in meters, returned as a vector, 2-D array, or a scalar. The `range` array is structured the same way as the `az` and `el`, described in the above syntaxes.

If the `timeIn` argument is not specified and when the `AutoSimulate` property of the satellite scenario is `true`, aer function returns the `range` history from `StartTime` to `StopTime`. Otherwise, it returns the `range` history from `StartTime` to `SimulationTime`.

Time samples corresponding to `az`, `el`, and `range` in UTC, returned as a row vector, or a scalar.

If the `timeIn` argument is not specified and when the `AutoSimulate` property of the satellite scenario is `true`, aer function returns the time sample history from `StartTime` to `StopTime`. Otherwise, it returns the time sample history from `StartTime` to `SimulationTime`.

## Version History

Introduced in R2021a