No License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
VRECKON: Find the endpoint of a geodesic on the ellipsoidal earth

5.0 | 3 ratings Rate this file 6 Downloads (last 30 days) File Size: 4.57 KB File ID: #17493 Version: 1.0

VRECKON: Find the endpoint of a geodesic on the ellipsoidal earth


Michael Kleder (view profile)


12 Nov 2007 (Updated )

Obtains a final location on ellipsoidal earth, given a start point, an azimuth and a distance.

| Watch this File

File Information

This function uses the Vincenty direct algorithm to solve the "forward geodesic problem," which is the problem of computing the endpoint of a geodesic (shortest-distance) path on the ellipsoidal earth, given the start point, a path length, and a starting azimuth. This process is also called "reckoning."

In 1975, Vincenty published a rapidly converging algorithm for this calculation. Since then, his algorithm has since seen significant implementation in geodesy and engineering. The algorithm is precise to within a few millimeters. Please see code comments for references.

Michael Kleder, Nov 2007


Vectorized Geodetic Distance And Azimuth On The Wgs84 Earth Ellipsoid inspired this file.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
20 Oct 2014 Rik Wisselink

After trying for 3 hours to generate an artificial gps-track (the task for the students would be figuring out the speed given a csv with coordinates and timestamps), I came across this. Thank you very much, exactly what I needed.

03 Jul 2014 Bradley Wright

Correction: commenting line 100 yields results in -180 to 180 convention

Comment only
24 Feb 2014 Adam Hart

Awesome! Just what I needed! Thanks!

29 Dec 2011 Kevin Ellis


I am having trouble producing the correct results using this submission. Over the past few days I have been trying to code my own program similar to this one and for a test point I kept getting the wrong answer. I eventually came across your code and it also gave the same answer my code gave for the test point. I have checked Google Earth and even the website that uses a Javascript to calculate the latitude and longitude of a point given a distance, bearing, and an initial point.

To illustrate my problem I have the following initial point latitude and longitude:

39° 44′ 42.41″N
105° 00′ 5.01″W



And the following distance (meters)

23.14288153 meters

And the following bearing

319°24′ 0″



Now when I send these values to the function you developed I get:

>> [x y] = vreckon(lat1, lon1, s, a12)

x =


y =


Now the value I get using the Javascript from the following website ( is:




As can be seen the latitude value matches well, but the longitude is far off. On that website the author even gives the code (using the same formulas you used) for the Javascript so I wasn't sure where the difference could be. Finally, I checked Google Earth and the latitude and longitude produced by the aforementioned website are the correct values. I believe the problem lies in using the "mod" function (my code uses it as well), but again I'm not sure.

Could you perhaps provide some insight into this problem? It would be of great help for my project where accuracy is a issue. Thanks.

Kevin Ellis

Comment only
27 Nov 2007 R Calabretta

Very useful tool for evaluating Required Navigation Performance (RNP) algorithms.

Thank you Michael. I appreciate the work you are doing in this area.

Contact us