Geographic tracks from starting and ending points

`[lat,lon] = track2(lat1,lon1,lat2,lon2)`

[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid)

[lat,lon] = track2(lat1,lon1,lat2,lon2,* units*)

[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid,

`units`

[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid,

`units`

[lat,lon] = track2(

`track`

mat = track2(...)

`[lat,lon] = track2(lat1,lon1,lat2,lon2)`

computes
great circle tracks on a sphere starting at the point `lat1,lon1`

and
ending at `lat2,lon2`

. The inputs can be scalar or
column vectors.

`[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid)`

computes
the great circle track on the ellipsoid defined by the input `ellipsoid`

. `ellipsoid`

is
a `referenceSphere`

, `referenceEllipsoid`

, or `oblateSpheroid`

object, or a vector
of the form `[semimajor_axis eccentricity]`

. If ```
ellipsoid
= []
```

, a sphere is assumed.

`[lat,lon] = track2(lat1,lon1,lat2,lon2,`

and * units*)

`[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid,``units`

)

are
both valid calling forms, which use the input string `units`

`units`

`'degrees'`

is assumed.`[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid,`

uses
the scalar input * units*,npts)

`npts`

to determine the number of
points per track computed. The default value of `npts`

is
100.`[lat,lon] = track2(`

uses
the * track*,...)

`track`

`track`

=
'gc'

, then great circle tracks are computed. If `track`

=
'rh'

, then rhumb line tracks are computed. If the `track`

`'gc'`

is assumed.`mat = track2(...)`

returns a single output
argument where `mat = [lat lon]`

. This is useful
if a single track is computed. Multiple tracks can be defined from
a single starting point by providing scalar inputs for `lat1,lon1`

and
column vectors for `lat2,lon2`

.

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.

% Set up the axes. axesm('mercator','MapLatLimit',[30 50],'MapLonLimit',[-40 40]) % Calculate the great circle track. [lattrkgc,lontrkgc] = track2(40,-35,40,35); % Calculate the rhumb line track. [lattrkrh,lontrkrh] = track2('rh',40,-35,40,35); % Plot both tracks. plotm(lattrkgc,lontrkgc,'g') plotm(lattrkrh,lontrkrh,'r')

Was this topic helpful?