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,npts)
[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,units) and
[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid,units)
are both valid calling forms, which use the input units to define the angle units of the
inputs and outputs. If you omit units, 'degrees'
is assumed.
[lat,lon] = track2(lat1,lon1,lat2,lon2,ellipsoid,units,npts) uses the
scalar input npts to determine the number of points per track
computed. The default value of npts is 100.
[lat,lon] = track2(track,...) uses the track to define either a great
circle or a rhumb line track. If , then great circle tracks are computed. If track =
'gc'track =
'rh', then rhumb line tracks are computed. If you omit 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.
% 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')