deg2km command does not calculate distance between two points
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello everyone.
I am trying to calculate distance between two geographical coordinates and I want to convert geographical coordinates to the km. Therefore I used deg2km function. However, I realize that it is not convert points properly.
For instance, I used these two points.
p_x=[5; 10]; %degree
p_y=[8; 16]; %degree
pos_y=deg2km(p_y,6378);
pos_x=deg2km(p_x,6378);
It returns as:
pos_x= [556.58549846099 1113.17099692198]
pos_y= [890.536797537587 1781.07359507517]
When I calculate distance ( sqrt((556.5-1113.2)^2+(890.5368-1781.1)^2) ) between these points I obtained distance as : 1050.2464
However I checked it google map and also other websites it should be 1042 km.
Do you have any suggestion to calculate distance and also points as kilometers properly?
Thanks in advance!
0 Kommentare
Antworten (1)
Priyanshu Mishra
am 31 Jan. 2020
Hi Hülya,
Distance given by the deg2km depens on what radius of earth you are considering. Default value given in MATLAB documentation is 6371 km. You considered radius as 6378 km that is why there are differences in the values of distances. Also, the metric you are considering for calculating the distance sqrt(x^2+y^2) is not completely correct, since in case of earth there are other factors also involved because of it's shape.
Siehe auch
Kategorien
Mehr zu Geodesy and Mapping finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!