stdist

Standard distance for geographic points

Syntax

dist = stdist(lat,lon)
dist = stdist(lat,lon,units)
dist = stdist(lat,lon,ellipsoid)
dist = stdist(lat,lon,ellipsoid,units,method)

Description

dist = stdist(lat,lon) computes the average standard distance for geographic data. This function assumes that the data is distributed on a sphere. In contrast, std assumes that the data is distributed on a Cartesian plane. The result is a single value based on the great-circle distance of the data points from their geographic mean point. When lat and lon are vectors, a single distance is returned. When lat and lon are matrices, a row vector of distances is given, providing the distances for each column of lat and lon. N-dimensional arrays are not allowed. Distances are returned in degrees of angle units.

dist = stdist(lat,lon,units) indicates the angular units of the data. When the standard angle units is omitted, 'degrees' is assumed. Output measurements are in terms of these units (as arc length distance).

dist = stdist(lat,lon,ellipsoid) specifies the shape of the Earth to be used with ellipsoid, which can be a referenceSphere, referenceEllipsoid, or oblateSpheroid object, or a vector of the form [semimajor_axis eccentricity]. The default is a unit sphere. Output measurements are in terms of the distance units of the semimajor axis of the ellipsoid.

dist = stdist(lat,lon,ellipsoid,units,method) specifies the method of calculating the standard distance of the data. The default, 'linear', is simply the average great circle distance of the data points from the centroid. Using 'quadratic' results in the square root of the average of the squared distances, and 'cubic' results in the cube root of the average of the cubed distances.

Background

The function stdm provides independent standard deviations in latitude and longitude of data points. stdist provides a means of examining data scatter that does not separate these components. The result is a standard distance, which can be interpreted as a measure of the scatter in the great circle distance of the data points from the centroid as returned by meanm.

The output distance can be thought of as the radius of a circle centered on the geographic mean position, which gives a measure of the spread of the data.

Examples

Create latitude and longitude lists using the worldcities data set and obtain standard distance deviation for group (compare with the example for stdm):

cities = shaperead('worldcities.shp', 'UseGeoCoords', true);
Paris = strcmp('Paris',{cities(:).Name});
London = strcmp('London',{cities(:).Name});
Rome = strcmp('Rome',{cities(:).Name});
Madrid = strcmp('Madrid',{cities(:).Name});
Berlin = strcmp('Berlin',{cities(:).Name});
Athens = strcmp('Athens',{cities(:).Name});
lat = [cities(Paris).Lat cities(London).Lat...
       cities(Rome).Lat cities(Madrid).Lat...
       cities(Berlin).Lat cities(Athens).Lat]
lon = [cities(Paris).Lon cities(London).Lon...
       cities(Rome).Lon cities(Madrid).Lon...
       cities(Berlin).Lon cities(Athens).Lon]

dist = stdist(lat,lon)

lat =
   48.8708   51.5188   41.9260   40.4312   52.4257   38.0164
lon =
    2.4131   -0.1300   12.4951   -3.6788   13.0802   23.5183
dist =
    8.1827

See Also

|

Introduced before R2006a