Sie verfolgen jetzt diese Einreichung
- Aktualisierungen können Sie in Ihrem Feed verfolgter Inhalte sehen.
- Je nach Ihren Kommunikationseinstellungen können Sie auch E-Mails erhalten.
This program calculates the distance between two locations (latitude and longitude) using the Haversine formula. The Haversine formula gives the shortest distance between two points over the earth's surface, ignoring elevation, hills, etc...
The program accepts two inputs that can be locations specified as either degrees, minutes, and seconds or by decimal degrees. The output is the distance in km, n.mi, and miles.
Examples:
haversine('53 08 50N, 001 50 58W', '52 12 16N, 000 08 26E') returns 170.2547
haversine([53.1472 -1.8494], '52 12.16N, 000 08.26E') returns 170.2508
haversine([53.1472 -1.8494], [52.2044 0.1406]) returns 170.2563
Zitieren als
Josiah Renfree (2026). Distance calculation using Haversine formula (https://de.mathworks.com/matlabcentral/fileexchange/27785-distance-calculation-using-haversine-formula), MATLAB Central File Exchange. Abgerufen .
Kategorien
Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und MATLAB Answers
Allgemeine Informationen
- Version 1.1.0.0 (4,61 KB)
Kompatibilität der MATLAB-Version
- Kompatibel mit allen Versionen
Plattform-Kompatibilität
- Windows
- macOS
- Linux
| Version | Veröffentlicht | Versionshinweise | Action |
|---|---|---|---|
| 1.1.0.0 | Removed use of the deg2rad function, which required the Mapping toolbox. The conversion is now done by simply multiplying degrees by pi/180. Clarified in the help section that the first element in LOC is latitude and the second is longitude. |
||
| 1.0.0.0 |
