Function File: dist = vincenty(pt1, pt2)
Function File: dist = vincenty(pt1, pt2, ellipsoid)
Function File: [dist, az] = vincenty(pt1, pt2)
Function File: [dist, az] = vincenty(pt1, pt2, ellipsoid)

Calculates the distance (in meters) between two (sets of) locations on an ellipsoid.

The formula devised by Thaddeus Vincenty is used with an accurate ellipsoidal model of the earth (ellipsoid). The default ellipsoidal model is ’WGS84’, which is the most globally accurate model.

pt1 and pt2 are two-column matrices of the form [latitude longitude]. The units for the input coordinates angles must be degrees. Optional argument ellipsoid defines the reference ellipsoid to use.

Sample values for ellipsoid are the following:

Modelellipsoid
WGS 1984 (default)referenceEllipsoid(7030)
GRS 1980referenceEllipsoid(7019)
G.B. Airy 1830referenceEllipsoid(7001)
Internacional 1924referenceEllipsoid(7022)
Clarke 1880referenceEllipsoid(7012)
Australian Nat.referenceEllipsoid(7003)

The sample model values are the following:

ModelMajor (km)Minor (km)1 / f
WGS 19846378.1376356.7523142298.257223563
GRS 19806378.1376356.7523141298.257222101
G.B. Airy 18306377.5633966356.256909299.3249646
Internacional 19246378.3886356.911946297.0
Clarke 18806378.2491456356.51486955293.465
Australian Nat.6378.16006356.774719298.25

Usage:

>> vincenty ([37, -76], [37, -9])
ans = 5830.081
>> vincenty ([37, -76], [67, -76], referenceEllipsoid (7019))
ans = 3337.843

See also: distance, referenceEllipsoid.

Package: mapping