文档介绍:飞越北极问题程序设计
程序设计: 余时伟
电子科技大学应用数学学院
第一条航线:北京——上海——东京——旧金山——纽约
航点
纬度
经度
北京
北纬40o
东经116o
上海
北纬31o
东经122 o
东京
北纬36o
东经140 o
旧金山
北纬37o
西经123 o
纽约
北纬41o
西经76o
第二条航线:北京——纽约
tic %time begin
clear
theta=[40,31,36,37,41,40]/180*pi;
fai=([116,122,140,-123,-76,116]+180)/180*pi;
R=6400+10;
x=R*cos(theta).*cos(fai);
y=R*cos(theta).*sin(fai);
z=R*sin(theta);
for i=1:6
cor{i}=[x(i),y(i),z(i)];
end
for i=1:5
th{i}=acos(dot(cor{i},cor{i+1})/(norm(cor{i})*norm(cor{i+1})));
end
A=R*[th{1},th{2},th{3},th{4}];
distance_1={'绕飞航程长度',fix(sum(A));'直飞航程长度',fix(th{5}*R)} ; %航程长度计算
distance_2={'北京到上海','上海到东京','东京到旧金山','旧金山到纽约'
fix(A(1)),fix(A(2)),fix(A(3)),fix(A(4))};
theta2=(-90:5:90)*pi/180;
fai2=(-180:5:180)*pi/180;
X=R*cos(theta2)'*cos(fai2);
Y=R*cos(theta2)'*sin(fai2);
Z=R*sin(theta2)'*ones(size(fai2));
load('','topo','topomap1');
whos topo topomap1;
contour(0:359,-89:90,topo,[0 0],'b');
axis equal
box on
set(gca,'XLim',[0 360],'YLim',[-90 90], ...
'XTick',[0 60 120 180 240 300 360], ...
'Ytick',[-90 -60 -30 0 30 60 90]);
hold on
image([0 360],[-90 90],topo,'CDataMapping', 'scaled');
colormap(topomap1);
cla reset
axis square off
= ;
= 1;
=;
= 20;
= 1;
= 'texture';