MATLAB Answers

Distances between specific points between two points

2 views (last 30 days)
Chihiro Omori
Chihiro Omori on 25 Apr 2019
Commented: darova on 27 Apr 2019
With Matrix of longitudes and latitudes, I would like to set the standard point on (lat, lon) = (40 -75)
and calculate the distances (in meter) between the standard point and each point (lat and lon individually).
My code is as follows.
x0 = 0;
y0 = 0;
lat0 = 40;
lon0 = -75;
dlat = latmat - lat0;
dlon = lonmat - lon0;
dx = 110*cosd(latmat)*dlon;
dy = 110*dlat;
x = 1000* (dx + x0);
y = 1000* (dy + y0):
The problem is Distances of X are extremely larger than those of Y.....

Answers (1)

Mark Sherstan
Mark Sherstan on 25 Apr 2019
Edited: Mark Sherstan on 25 Apr 2019
Use this awesome function from the file exchange: https://www.mathworks.com/matlabcentral/fileexchange/38812-latlon-distance and then place it in a loop to store your results in an array or otherwise.

  0 Comments

Sign in to comment.

Sign in to answer this question.