Mapping Toolbox | ![]() ![]() |
Compute mean for geographic data
Syntax
[latmean,lonmean] = meanm(lat,lon) [latmean,lonmean] = meanm(lat,lon,units) [latmean,lonmean] = meanm(lat,lon,geoid) [latmean,lonmean] = meanm(lat,lon,geoid,units) geomeans = meanm(...)
Background
Finding the mean position of geographic points is more complicated than simply averaging the latitudes and longitudes. meanm
determines mean position through 3-dimensional vector addition. See the section entitled "Geographic Statistics" in the "Mapping Applications" chapter of the Mapping Toolbox User's Guide.
Description
[latmean,lonmean] = meanm(lat,lon) returns row vectors of the geographic mean positions of the columns of the input latitude and longitude points.
[latmean,lonmean] = meanm(lat,lon,units
) indicates the angular units of the data. When the standard angle string units
is omitted, 'degrees'
is assumed.
[latmean,lonmean] = meanm(lat,lon,geoid) specifies the elliptical definition of the Earth to be used with the two-element geoid
vector. The default geoid model is a spherical Earth, which is sufficient for most applications.
If a single output argument is used, then geomeans = [latmean,longmean]
. This is particularly useful if the original lat
and lon
inputs are column vectors.
Examples
Create random latitude and longitude matrices:
lat = rand(3) lat = 0.9501 0.4860 0.4565 0.2311 0.8913 0.0185 0.6068 0.7621 0.8214 lon = rand(3) lon = 0.4447 0.9218 0.4057 0.6154 0.7382 0.9355 0.7919 0.1763 0.9169 [latmean,lonmean] = meanm(lat,lon,'radians') latmean = 0.6004 0.7395 0.4448 lonmean = 0.6347 0.6324 0.7478
See Also
filterm |
Geographic filter for datasets |
hista |
Spatial equal area histogram |
histr |
Spatial equirectangular histogram |
stdist |
Standard distances for geographic data |
stdm |
Standard deviation for geographic data |
![]() | mdistort | meshgrat | ![]() |