# track1

Geographic tracks from starting point, azimuth, and range

## Syntax

```[lat,lon] = track1(lat0,lon0,az) [lat,lon] = track1(lat0,lon0,az,arclen) [lat,lon] = track1(lat0,lon0,az,arclen,ellipsoid) [lat,lon] = track1(lat0,lon0,az,angleunits) [lat,lon] = track1(lat0,lon0,az,arclen,angleunits) [lat,lon] = track1(lat0,lon0,az,arclen,ellipsoid,angleunits) [lat,lon] = track1(lat0,lon0,az,arclen,ellipsoid,angleunits,npts) [lat,lon] = track1(trackstr,...) mat = track1(...) ```

## Description

`[lat,lon] = track1(lat0,lon0,az)` computes complete great circle tracks on a sphere starting at the point `lat0,lon0` and proceeding along the input azimuth, `az`. The inputs can be scalar or column vectors.

`[lat,lon] = track1(lat0,lon0,az,arclen)` uses the input `arclen` to specify the arc length of the great circle track. `arclen` is specified in units of degrees of arc. If `arclen` is a column vector, then the track is computed from the starting point, with positive distance measured easterly. If `arclen` is a two column matrix, then the track is computed starting at the range in the first column and ending at the range in the second column. If ```arclen = []```, then the complete track is computed.

`[lat,lon] = track1(lat0,lon0,az,arclen,ellipsoid)` computes the track along a geodesic arc on the ellipsoid defined by the input `ellipsoid`, which can be a `referenceSphere`, `referenceEllipsoid`, or `oblateSpheroid` object, or a vector of the form ```[semimajor_axis eccentricity]```. `arclen` must be expressed in length units that match the units of the semimajor axis — unless `ellipsoid` is `[]` or the semimajor axis length is zero. In these special cases, `arclen` is assumed to be in degrees of arc and the tracks are computed on a sphere, as in the preceding syntax.

`[lat,lon] = track1(lat0,lon0,az,angleunits)`,
`[lat,lon] = track1(lat0,lon0,az,arclen,angleunits)`, and
`[lat,lon] = track1(lat0,lon0,az,arclen,ellipsoid,angleunits)` where `angleunits` defines the units of the input and output angles as `'degrees'` or `'radians'`.

`[lat,lon] = track1(lat0,lon0,az,arclen,ellipsoid,angleunits,npts)` uses the scalar input `npts` to specify the number of points per track. The default value of `npts` is 100.

`[lat,lon] = track1(trackstr,...)` where `trackstr` is a string scalar or a character vector that defines either a great circle (`'gc'`) or rhumb line track (`'rh'`). If `trackstr` is `'gc'`, then either great circle (given a sphere) or geodesic (given an ellipsoid) tracks are computed. If `trackstr` is `'rh'`, then the rhumb line tracks are computed.

`mat = track1(...)` returns a single output argument `mat` such that `mat = [lat lon]`. This is useful if only a single track is computed.

Multiple tracks can be defined from a single starting point by providing scalar `lat0` and `lon0` and column vectors for `az` and `arclen`.

## Examples

```% Set up the axes. axesm('mercator','MapLatLimit',[-60 60],'MapLonLimit',[-60 60]) gridm on; plabel on; mlabel on; % Plot the great circle track in green. [lattrkgc,lontrkgc] = track1(0,0,45,[-55 55]); plotm(lattrkgc,lontrkgc,'g') % Plot the rhumb line track in red. [lattrkrh,lontrkrh] = track1('rh',0,0,45,[-55 55]); plotm(lattrkrh,lontrkrh,'r')``` collapse all

### Track Lines

A path along the surface of the Earth connecting two points is a track. Two types of track lines are of interest geographically, great circles and rhumb lines. Great circles represent the shortest possible path between two points. Rhumb lines are paths with constant angular headings. They are not, in general, the shortest path between two points.

Full great circles bisect the Earth; the ends of the track meet to form a complete circle. Rhumb lines with true east or west azimuths are parallels; the ends also meet to form a complete circle. All other rhumb lines terminate at the poles; their ends do not meet. 