Main Content

stdm

Standard deviation for geographic points

Syntax

[latdev,londev] = stdm(lat,lon)
[latdev,londev] = stdm(lat,lon,ellipsoid)
[latdev,londev] = stdm(lat,lon,units)

Description

[latdev,londev] = stdm(lat,lon) returns row vectors of the latitude and longitude geographic standard deviations for the data points specified by the columns of lat and lon.

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

[latdev,londev] = stdm(lat,lon,units) indicates the angular units of the data. When you omit units, 'degrees' is assumed. Output measurements are in terms of these units (as arc length distance).

If a single output argument is used, then geodevs = [latdev longdev]. This is particularly useful if the original lat and lon inputs are column vectors.

Background

Determining the deviations of geographic data in latitude and longitude is more complicated than simple sum-of-squares deviations from the data averages. For latitude deviation, a straightforward angular standard deviation calculation is performed from the geographic mean as calculated by meanm. For longitudes, a similar calculation is performed based on data departure rather than on angular deviation. See Geographic Statistics for Point Locations on a Sphere in the Mapping Toolbox™ User's Guide.

Examples

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

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]
[latstd,lonstd]=stdm(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
latstd =
    2.7640
lonstd =
   68.7772

Version History

Introduced before R2006a