# lookangles

Satellite look angles from receiver and satellite positions

Since R2021a

## Syntax

``[az,el,vis] = lookangles(recPos,satPos)``
``[az,el,vis] = lookangles(recPos,satPos,maskAngle)``

## Description

````[az,el,vis] = lookangles(recPos,satPos)` returns the look angles and visibilities of satellite positions for a given receiver position. The azimuth `az` and elevation `el` are the look angles in degrees in the Earth-centered Earth-fixed (ECEF) coordinate system. The visibility of the satellites `vis` is a logical array that the function calculates using the default receiver mask angle of 10 degrees.```
````[az,el,vis] = lookangles(recPos,satPos,maskAngle)` returns the look angles and visibilities of satellites with a specified mask angle `maskAngle` in degrees.```

example

## Examples

collapse all

Use the `lookangles` function to get the azimuth and elevation angles of satellites for given satellite and receiver positions. Specify a mask angle of 5 degrees. Get the satellite positions using the `gnssconstellation` function.

Specify a receiver position in geodetic coordinates (latitude, longitude, altitude).

`recPos = [42 -71 50];`

Get the satellite positions for the current time.

```t = datetime('now'); gpsSatPos = gnssconstellation(t);```

Specify a mask angle of 5 degrees.

`maskAngle = 5;`

Get the azimuth and elevation look angles for the satellite positions. The `vis` output indicates which satellites are visible. Get the total using `nnz`.

```[az,el,vis] = lookangles(recPos,gpsSatPos,maskAngle); fprintf('%d satellites visible at %s.\n',nnz(vis),t);```
```9 satellites visible at 20-Jul-2024 14:58:45. ```

## Input Arguments

collapse all

Receiver position in geodetic coordinates, specified as a three-element vector of the form [latitude longitude altitude]

Data Types: `single` | `double`

Satellite positions in the Earth-centered Earth-fixed (ECEF) coordinate system in meters, specified as an N-by-3 matrix of scalars. N is the number of satellites in the constellation.

Data Types: `single` | `double`

Elevation mask angle of the receiver, specified as a positive scalar in degrees.

Data Types: `single` | `double`

## Output Arguments

collapse all

Azimuth angles for visible satellite positions, returned as an n-element vector of angles. n is the number of visible satellite positions in the plot. Azimuth angles are measured in degrees, clockwise-positive from the north direction looking down.

Example: `[25 45 182 356]`

Data Types: `double`

Elevation angles for visible satellite positions, returned as an n-element vector of angles. n is the number of visible satellite positions in the plot. Elevation angles are measured from the horizon line with 90 degrees being directly up.

Example: `[45 90 27 74]`

Data Types: `double`

Satellite visibility, returned as an n-element `logical` array. Each element indicates whether the satellite position given by `az` and `el` is visible.

Data Types: `logical`

## Version History

Introduced in R2021a