Reasons for shorter distance calculated by 'distance'?

1 visualización (últimos 30 días)
Ali Y.
Ali Y. el 17 de Jul. de 2015
Editada: bizhan el 27 de Jul. de 2015
What would be the reason for shorter distance calculated by the following code?
clc
X = [ 45.1612 ; 45.1585 ; 45.1252 ; 45.0853 ];
Y = [ 38.3228 ; 38.3749 ; 38.4162 ; 38.4516 ];
E = wgs84Ellipsoid('km');
for i = 2:numel(X)
[dis, az] = distance( Y(i-1), X(i-1), Y(i), X(i), E, 'degrees');
end
dis = cumsum(dis);
az = mean(az);
disp([dis, az])
I have an arched line of length 16.603506 km, calculated in 'ArcMap'. X and Y are coordinates of vertices of the line, so that, X(1) and Y(1) are the coordinate of first (starting) vertex and X(end) and Y(end) are those of last (ending) vertex. According to the code the distance between starting and ending vertices on the line is 15.7603 km. My question is where of the code is wrong that cause this discrepancy? Note: Total number of vertices of the line is 289 and the distance between starting and ending vertices are 15.7688 km. Any help is appreciated. Thank you in advance for your help.

Respuestas (1)

bizhan
bizhan el 27 de Jul. de 2015
Editada: bizhan el 27 de Jul. de 2015
I tried the havesine formulas to calculate the spherical distance and the result is 15.78 the same as the "distance" function. I think both are using spherical or eliptical earth assumption. for better and more accurate solutions, local geoid assumption and formulas will be necessary.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by