matlab利用经纬度计算距离,MATLAB函数可计算两个坐标(纬度和经度)之间的距离...
How can I calculate distance between two world map coordinates (latitude and longitude) using MATLAB R2015a (in meters)?
解决方案
If you don't have access to the MATLAB Mapping toolbox then a simple approximation is to use the Haversine formula. Here is an excerpt from the link:
The haversine formula is an equation important in navigation, giving great-circle distances between two points on a sphere from their longitudes and latitudes. It is a special case of a more general formula in spherical trigonometry, the law of haversines, relating the sides and angles of spherical triangles.
Here is a MATLAB implementation:
function rad = radians(degree)
% degrees to radians
rad = degree .* pi / 180;
end;
function [a,c,dlat,dlon]=haversine(lat1,lon1,lat2,lon2)
% HAVERSINE_FORMULA.AWK - converted from AWK
dlat = radians(lat2-lat1);
dlon = radians(lon2-lon1);
lat1 = radians(lat1);
lat2 = radians(lat2);
a = (sin(dlat./2)).^2 + cos(lat1) .* cos(lat2) .* (sin(dlon./2)).^2;
c = 2 .* asin(sqrt(a));
arrayfun(@(x) printf("distance: %.4f km\n",6372.8 * x), c);
end;
[a,c,dlat,dlon] = haversine(36.12,-86.67,33.94,-118.40); % BNA to LAX
matlab利用经纬度计算距离,MATLAB函数可计算两个坐标(纬度和经度)之间的距离...相关推荐
- matlab利用经纬度计算距离_【Matlab】根据经纬度计算两点间的球面距离
做建模或者研究空间数据,可能会遇到"根据经纬度计算两点间的球面距离"的问题,网上的资料很多,都是各种公式推导,但是一旦按公式编程计算,很可能得不到正确的距离.根本原因是在" ...
- 根据高德地图得出的坐标算出两点之间的距离 java
高德地图现在使用比较多了,但是高德地图计算两点之间的距离有些问题.下面提供一个很好的解决方案. 代码如下: public class Distribution {// 经度double longitu ...
- matlab利用霍夫,基于matlab的霍夫变换
霍夫变换(限量版) 基于matlab的霍夫变换 一.简单介绍 Hough变换是图像处理中从图像中识别几何形状的基本方法之一. Hough变换的基本原理在于利用点与线的对偶性,将原始图像空间的给定的曲线 ...
- matlab利用图片矩阵画图,matlab 根据邻接矩阵作图【借鉴实操】
<matlab 根据邻接矩阵作图[借鉴实操]>由会员分享,可在线阅读,更多相关<matlab 根据邻接矩阵作图[借鉴实操](4页珍藏版)>请在人人文库网上搜索. 1.Matla ...
- matlab利用数据求公式,matlab新手,求帮助!主要是如何将数据和公式导入
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 这是别人给我的程序,我想问一下怎么把我的两个excel数据导入,以及公式怎么写? clc; clear all; close all;data=dlmre ...
- python 函数计算乘积_Python函数——允许计算两个数的乘积,变成可接收一个或多个数并计算乘积:...
设计函数: # -*- coding: utf-8 -*- def product(x,*z): sum=1*x for t in z: sum=sum*t return sum 执行函数: # 测试 ...
- 关于函数凹凸性两种定义与二阶导数符号之间的联系证明
什么是函数的凹凸性 函数的凹凸性即对一个在某区间A上连续的函数,它的图像上凸或者上凹,则分别称为凸函数或者凹函数.而对于在某个区间内既有凹图像又有凸图像,则将凹图像所在区间称为函数的凹区间,凸图像所在 ...
- 高德地图获取坐标距离_【转】根据高德地图得出的坐标算出两点之间的距离
摘自 http://blog.csdn.net/u012251421/article/details/41242891 public static string GetDistance(double ...
- 基于js利用经纬度进行两地的距离计算
转自:http://www.storyday.com/html/y2009/2212_according-to-latitude-and-longitude-distance-calculation- ...
最新文章
- 仅需6步,教你轻易撕掉app开发框架的神秘面纱(1):确定框架方案
- stat_count() must not be used with a y aesthetic
- [LeetCode]Remove Linked List Elements
- 把MSSQL2005转换成MSSQL2000
- leetcode 202. Happy Number
- 使用 Blazor 开发内部后台(三):登录
- 发掘Apache Camel的力量
- 如何往eclipse中导入maven项目
- iPhone 13将减产1000万部,因特定芯片供应不足
- 当append遇到make遇到的坑
- 手机NFC天线的集总参数设计
- 一些实用的小网站、小工具、软件
- C 程序设计语言——第七章练习题
- 编译openssl1.1.1f for android
- 《鱿鱼游戏》开场了|谁才是影评人的御用写作工具
- esmtp 源码 分析
- objectArx --- ADS篇
- python代码加密运行在win10_如何在Win10上正确安装Python,VSCode和flake8
- Shopee开店不懂英语怎么办?
- Zeal - 离线 API 文档大全