# angle

Angle between sites

Since R2019b

## Syntax

``[az,el] = angle(site1,site2)``
``[az,el] = angle(site1,site2,path)``
``[az,el] = angle(___,Name,Value)``

## Description

example

````[az,el] = angle(site1,site2)` returns the azimuth and elevation angles between `site1` and `site2`.```

example

````[az,el] = angle(site1,site2,path)` returns the angles using a specified path type, either a Euclidean or great circle path.```
````[az,el] = angle(___,Name,Value)` returns the azimuth and elevation angles with additional options specified by name-value arguments.```

## Examples

collapse all

```tx = txsite(Name="MathWorks",Latitude=42.3001,Longitude=-71.3504); rx = rxsite(Name="Fenway Park",Latitude=42.3467,Longitude=-71.0972);```

Get the azimuth and elevation angles between the sites.

`[az,el] = angle(tx,rx)`
```az = 14.0142 ```
```el = -0.2805 ```

Get the azimuth angle between sites in degrees clockwise from north.

```azFromEast = angle(tx,rx); % Unit: degrees counter-clockwise from east azFromNorth = -azFromEast + 90 % Convert angle to clockwise from north```
```azFromNorth = 75.9858 ```

```tx = txsite(Name="MathWorks",Latitude=42.3001,Longitude=-71.3504); rx = rxsite(Name="Fenway Park",Latitude=42.3467,Longitude=-71.0972);```

Get the azimuth and elevation angles between the sites.

`[az,el] = angle(tx,rx,"greatcircle")`
```az = 14.0635 ```
```el = 0 ```

## Input Arguments

collapse all

Transmitter or receiver site, specified as a `txsite` or `rxsite` object. You can use array inputs to specify multiple sites.

Measurement path type, specified as one of the following:

• `'euclidean'` — Use the shortest path through space connecting the antenna center positions of the sites.

• `'greatcircle'` — Use the shortest path on the surface of the earth connecting the latitude and longitude locations of the sites. This path uses a spherical Earth model.

Data Types: `char`

### Name-Value Arguments

Specify optional pairs of arguments as `Name1=Value1,...,NameN=ValueN`, where `Name` is the argument name and `Value` is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose `Name` in quotes.

Example: `'Map','siteviewer1'`

Map for visualization or surface data, specified as a `siteviewer` object, a `triangulation` object, a string scalar, or a character vector. Valid and default values depend on the coordinate system.

Coordinate SystemValid map valuesDefault map value
`"geographic"`
• The current `siteviewer` object or a new `siteviewer` object if none are open

• `"gmted2010"`, if the function is called with an output

`"cartesian"`
• `"none"`

• A `siteviewer` object

• The name of a glTF™ file

• The name of an STL file

• A `triangulation` object

• `"none"`

a Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks®.

In most cases, if you specify this argument as a value other than a `siteviewer` or `"none"`, then you must also specify an output argument.

Data Types: `char` | `string`

## Output Arguments

collapse all

Azimuth angle between `site1` and `site2`, returned as M-by-N arrays in degrees. M is the number of sites in `site1` and N is the number of sites in `site2`. The azimuth angle is expressed in degrees counter-clockwise from the east (for geographic sites), or from the global x-axis around the global z-axis (for Cartesian sites), ranging from -180 to 180 degrees.

Elevation angle between `site1` and `site2`, returned as M-by-N arrays in degrees. M is the number of sites in `site2` and N is the number of sites in `site1`. The elevation angle is expressed in degrees from the horizontal (or X-Y) plane, ranging from -90 to 90 degrees.

When you specify the path type as `'greatcircle'`, the elevation angle is always zero.

## Version History

Introduced in R2019b