# departure

Departure of longitudes at specified latitudes

## Syntax

``d = departure(lon1,lon2,lat)``
``d = departure(lon1,lon2,lat,ellipsoid)``
``d = departure(___,units)``

## Description

example

````d = departure(lon1,lon2,lat)` calculates the departure from `lon1` to `lon2` at the latitude `lat`. Departure is the distance along a specific parallel between two meridians. This syntax references the coordinates to the unit sphere and returns `d` as a spherical distance in degrees.```

example

````d = departure(lon1,lon2,lat,ellipsoid)` specifies a reference ellipsoid for the coordinates. This syntax returns `d` in the units of the semimajor axis of the reference ellipsoid.```
````d = departure(___,units)` specifies the angle units, in addition to any combination of input arguments from the previous syntaxes.```

## Examples

collapse all

Calculate the departure distance between the longitudes 10ºW and 20ºW at the latitudes 10ºN, 40ºN, and 80ºN. By default, the `departure` function returns spherical distances in degrees.

```lon1 = 10; lon2 = 20; d1 = departure(lon1,lon2,10)```
```d1 = 9.8481 ```
`d2 = departure(lon1,lon2,40)`
```d2 = 7.6604 ```
`d3 = departure(lon1,lon2,80)`
```d3 = 1.7365 ```

Create a World Geodetic System of 1984 (WGS84) reference ellipsoid with a length unit of nautical miles.

`wgs84 = wgs84Ellipsoid("nm");`

Calculate the departure distance between the longitudes 10ºW and 20ºW at the latitudes 10ºN, 40ºN, and 80ºN. Reference the coordinates to the ellipsoid. When you specify a reference ellipsoid as input to the `departure` function, the function returns linear distances in the units of the semimajor axis of the ellipsoid.

```lon1 = 10; lon2 = 20; d1 = departure(lon1,lon2,10,wgs84)```
```d1 = 592.0052 ```
`d2 = departure(lon1,lon2,40,wgs84)`
```d2 = 461.0899 ```
`d3 = departure(lon1,lon2,80,wgs84)`
```d3 = 104.7164 ```

## Input Arguments

collapse all

Longitude of the first point, specified as a scalar or array.

The sizes of `lon1`, `lon2`, and `lat` must match.

Data Types: `single` | `double`

Longitude of the second point, specified as a scalar or array.

The sizes of `lon1`, `lon2`, and `lat` must match.

Data Types: `single` | `double`

Latitude of the points, specified as a scalar or array.

The sizes of `lon1`, `lon2`, and `lat` must match.

Data Types: `single` | `double`

Reference ellipsoid, specified as a `referenceSphere` object, a `referenceEllipsoid` object, an `oblateSpheroid` object, or a two-element vector of the form `[semimajor_axis eccentricity]`, where `semimajor_axis` is the length of the semimajor axis and `eccentricity` is the eccentricity. The values `semimajor_axis` and `eccentricity` must be of data type `double`.

The default value of `[1 0]` represents the unit sphere.

Angle unit, specified as one of these options:

• `"degrees"` — Degrees

• `"radians"` — Radians

If you do not specify a reference ellipsoid, this argument determines the angle units for the coordinates and the departure (as a spherical distance). If you specify a reference ellipsoid, this argument only determines the angle units for the coordinates.

Data Types: `char` | `string`

## Output Arguments

collapse all

Departure distance, returned as a scalar or an array of the same size as `lon1`, `lon2`, and `lat`.

• When you do not specify a reference ellipsoid as input, `d` is a spherical distance in degrees. You can return a spherical distance in radians by using the `units` input argument.

• When you specify a reference ellipsoid as input, `d` is a linear distance in the units of the semimajor axis of the ellipsoid.

collapse all

### Departure

Departure is the distance along a parallel between two points. Whereas a degree of latitude is always the same distance, a degree of longitude is different in length at different latitudes. In practice, this distance is usually given in nautical miles.

## Version History

Introduced before R2006a