0
votes

I have a trajectory defined in Lat/Long coordinates in "n" points. I need to estimate its length over the surface of the earth:

Lat = [la1 la2 la3 la4 la5 la6];
Lon = [lo1 lo2 lo3 lo4 lo5 lo6];

How can I do this in Matlab? I've tried to use the command distance, but it seems it doesn't do this?

Thanks!

1
That depends on what projective model you're using to represent the earth. What projective model are you using?rayryeng
I'm pretty sure it's WGS84Oliver Amundsen
Did you try using trigonometrie formulas? If you have the earth's radius, center and the angles, all you have to do is calculate the length of the arc passing by your two pointsThaBomb
Hey, I thought about that, but it might be too time consuming... :/ There must be sthg in Matlab that does it!Oliver Amundsen
Check the Haversine Formula and try to impliment it on your own.ThaBomb

1 Answers

0
votes
[arclen,az] = distance(lat1,lon1,lat2,lon2)   
[arclen,az] = distance(lat1,lon1,lat2,lon2,ellipsoid)

Check the matlab documentation

Something similar to this shouldn't be very hard to write:

sum = 0;
for i=1:(size(Lat)-1)
    sum = sum + distance(Lat(i),Lon(i),Lat(i+1),Lon(i+1));
//end (Sorry I haven't used matlab in over a year, and forgot the syntax)