我可以计算两点之间的距离,但我无法计算两点之间的角度。请帮我。这是我的matlab代码:
disp('Input the latitude and longitude of each point as prompted')
disp('Lat and Long should be in degrees (convert minutes and seconds)')
disp('Use negative degrees for west and south')
lat1 = input ('Latitude point 1: ');
lon1 = input ('Longitude point 1: ');
lat2 = input ('Latitude point 2: ');
lon2 = input ('Longitude point 2: ');
latrad1 = lat1*pi/180;
lonrad1 = lon1*pi/180;
latrad2 = lat2*pi/180;
lonrad2 = lon2*pi/180;
londif = abs(lonrad2-lonrad1);
raddis = acos(sin(latrad2)*sin(latrad1)+
cos(latrad2)*cos(latrad1)*cos(londif));
nautdis = raddis * 3437.74677;
statdis = nautdis * 1.1507794;
stdiskm = nautdis * 1.852;
disp(' ')
fprintf('Distance in radians: = %7.4f \n', raddis);
fprintf('Distance in statute miles: = %7.2f \n',statdis);
fprintf('Distance in kilometers: = %7.2f \n', stdiskm);