Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. %% Define latlon grid and coordinates (lon follows lat)
  2.  
  3. lon_grid = transpose([40.1 40.12 40.14; 40.3 40.32 40.34; 40.5 40.52 40.54]);
  4. lat_grid = transpose([30 30.2 30.4;30.02 30.22 30.42; 30.04 30.24 30.44]);
  5. coord = [30.4125 40.4043];
  6.  
  7. %% Compute great circle distance
  8. dist = distance('gc',coord(1),coord(2),lat_grid,lon_grid);
  9.  
  10. %% Retrieve index of minimum distance
  11. [value,array_index] = min(distance(:));
  12. [i,j] = ind2sub(size(dist),array_index);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement