distance between two geo points , I am trying to convert Rhumb lines distance calculation in matlab but it is not work properly

2 views (last 30 days)
I am trying to convert Rhumb lines distance calculation in matlab but it is not work properly can some body help :
%rhumb line
clc
th1=4.385704984670893; % latitude 1
th2=4.382316850229801; % latitude 2
lon1= 100.97986760432356 ; % longitude 1
lon2= 100.96958025244206 ; % longitude 2
Dlon=lon2-lon1;
Dth=th2-th1;
R=6371
LD=log(tan(pi/4+th2/2)/tan(pi/4+th1/2)); % latitude difference
cos(th1)
abs(LD);
q=Dth/LD;
d=sqrt((Dth)^2 + ((q)^2) * (Dlon)^2)*R
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% following is pic of javascript coade and description

Answers (0)

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!