# location

Location coordinates at a given distance and angle from site

## Syntax

``sitelocation = location(site) ``
``[lat,lon] = location(site) ``
``[___] = location(site,distance,azimuth) ``

## Description

````sitelocation = location(site) ` returns the site location of the antenna.```

example

````[lat,lon] = location(site) `returns the latitude and longitude of the antenna site.```
````[___] = location(site,distance,azimuth) `returns the new location achieved by moving the antenna site by the distance specified in the direction of the azimuth angle. The location is calculated by moving along a great circle path using a spherical Earth model.```

## Examples

collapse all

Create a site 1 km north of a given site.

Create the first transmitter site.

```tx = txsite('Name','MathWorks',... 'Latitude',42.3001, ... 'Longitude',-71.3504);```

Calculate the location 1 km north of the first site.

`[lat,lon] = location(tx,1000,90)`
```lat = 42.3091 ```
```lon = -71.3504 ```

Create a second transmitter site at the location specified by `lat` and `lon`.

```tx2 = txsite('Name','Second transmitter', ... 'Latitude',lat, ... 'Longitude',lon);```

Show the two transmitter sites.

```show([tx,tx2]) ```

## Input Arguments

collapse all

Antenna site, specified as a scalar or an array. It is either a txsite or a rxsite object. For more information, see `txsite`, and `rxsite`

### Note

If `distance` or `azimuth` is a vector, then site must be a scalar.

Distance to move antenna site, specified as a scalar or vector in meters.

Azimuth angle, specified as a scalar or vector in degrees. Azimuth angle is measured counterclockwise from due east.

## Output Arguments

collapse all

Location of antenna site, returned as an M-by-`2` matrix with each element unit in degrees. M is the number of sites in sites. The location value includes the latitude and longitude of the antenna site.

Latitude of one or more antenna sites, returned as an M-by-`1` vector with each element unit in degrees. M is the number of sites in `site`.

Longitude of one or more antenna sites, returned as an M-by-`1` matrix with each element unit in degrees. M is the number of sites in `site`. The output is wrapped so that the values are in the range `[-180 180]`.