Mapping Toolbox | ![]() ![]() |
Determine courses and distances between navigational track waypoints
Syntax
[course,dist] = legs(lat,lon) [course,dist] = legs(lat,lon,method
) [course,dist] = legs(pts) [course,dist] = legs(pts,method
) mat = legs(lat,...)
Description
This is a navigation function. All angles are in degrees, and all distances are in nautical miles. Track legs are the courses and distances traveled between navigational waypoints.
[course,dist] = legs(lat,lon) returns the azimuths (course
) and distances (dist
) between navigational waypoints, which are specified by the column vectors lat
and lon
.
[course,dist] = legs(lat,lon,method
) specifies the logic for the leg characteristics. If the string method
is 'rh'
(the default), course
and dist
are calculated in a rhumb line sense. If method
is 'gc'
, great circle calculations
are used.
[course,dist] = legs(pts) allows the user to input the waypoints in a single, two-column matrix pts
.
mat = legs(lat,...) packs up the outputs into a single, two-column matrix, mat
.
Examples
Imagine an airplane taking off from Logan International Airport in Boston (42.3ºN,71ºW) and travelling to LAX in Los Angeles (34ºN,118ºW). The pilot wishes to file a flight plan that takes the plane over O'Hare Airport in Chicago (42ºN,88ºW) for a navigational update, while maintaining a constant heading on each of the two legs of the trip.
What are those headings and how long are the legs?
lat = [42.3; 42; 34]; long = [-71; -88; -118]; [course,dist] = legs(lat,long,'rh') course = 268.6365 251.2724 dist = 1.0e+03 * 0.7564 1.4950
Upon takeoff, the plane should proceed on a heading of about 269º for 756 nautical miles, then alter course to 251º for another 1495 miles.
How much farther is it travelling by not following a great circle path between waypoints? Using rhumb lines, it is travelling:
The great circle path is less than one-half of one percent shorter.
See Also
dreckon |
Dead reckon points for a track |
gcwaypts |
Find waypoints along a great circle |
navfix |
Mercator-based navigational fixing |
track |
Connect waypoints |
![]() | km2deg, km2nm, km2rad, km2sm | lightm | ![]() |