-
Notifications
You must be signed in to change notification settings - Fork 3
/
bearing.m
32 lines (28 loc) · 905 Bytes
/
bearing.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function out_angle = bearing(latlon1,latlon2);
% (C) Nick Holschuh - University of Washington - 2016 (Nick.Holschuh@gmail.com)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The inputs are:
%
% ________ -
% ________ -
% ________ -
% ________ -
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The outputs are:
%
% ________ -
% ________ -
% ________ -
% ________ -
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The Dependencies are:
%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
out_angle = atan2(sin(latlon2(:,2)-latlon1(:,2)).*cos(latlon2(:,1)),cos(latlon1(:,1)).*sin(latlon2(:,1)) - ...
sin(latlon1(:,1)).*cos(latlon2(:,1)).*cos(latlon2(:,2)-latlon1(:,2)));
end