飞越北极问题程序设计_地球.doc

上传人:枫** 文档编号:547773906 上传时间:2023-09-27 格式:DOC 页数:4 大小:111.51KB
返回 下载 相关 举报
飞越北极问题程序设计_地球.doc_第1页
第1页 / 共4页
飞越北极问题程序设计_地球.doc_第2页
第2页 / 共4页
飞越北极问题程序设计_地球.doc_第3页
第3页 / 共4页
飞越北极问题程序设计_地球.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《飞越北极问题程序设计_地球.doc》由会员分享,可在线阅读,更多相关《飞越北极问题程序设计_地球.doc(4页珍藏版)》请在金锄头文库上搜索。

1、飞越北极问题程序设计程序设计: 余时伟电子科技大学应用数学学院2008.3.25第一条航线:北京上海东京旧金山纽约航点纬度经度北京北纬40o东经116o上海北纬31o东经122 o东京北纬36o东经140 o旧金山北纬37o西经123 o纽约北纬41o西经76o第二条航线:北京纽约tic %time begincleartheta=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*si

2、n(theta);for i=1:6 cori=x(i),y(i),z(i);endfor i=1:5 thi=acos(dot(cori,cori+1)/(norm(cori)*norm(cori+1);endA=R*th1,th2,th3,th4;distance_1=绕飞航程长度,fix(sum(A);直飞航程长度,fix(th5*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)*p

3、i/180;X=R*cos(theta2)*cos(fai2);Y=R*cos(theta2)*sin(fai2);Z=R*sin(theta2)*ones(size(fai2);load(topo.mat,topo,topomap1);whos topo topomap1;contour(0:359,-89:90,topo,0 0,b);axis equalbox onset(gca,XLim,0 360,YLim,-90 90, . XTick,0 60 120 180 240 300 360, . Ytick,-90 -60 -30 0 30 60 90);hold onimage(0

4、360,-90 90,topo,CDataMapping, scaled);colormap(topomap1);cla resetaxis square offprops.AmbientStrength = 0.1;props.DiffuseStrength = 1;props.SpecularColorReflectance =0.5; props.SpecularExponent = 20;props.SpecularStrength = 1;props.FaceColor= texture;props.EdgeColor = none;props.FaceLighting = phon

5、g;props.Cdata = topo;surface(X,Y,Z,props); %画地球表面并进行光照和材质处理axis offaxis equallight(position,-8000 300 9200);light(position,8000 9000 -9200);light(position,800 -500 200);light(position,8500 5000 -8600, color, .6 .2 .2);view(-30,59)hold ontheta3=31/180*pi; %成都地理位置fai3=103/180*pi+pi;x3=R*cos(theta3).*c

6、os(fai3);y3=R*cos(theta3).*sin(fai3);z3=R*sin(theta3);theta4=48.194/180*pi; %伦敦地理位置fai4=2/180*pi+pi; x4=R*cos(theta4).*cos(fai4);y4=R*cos(theta4).*sin(fai4);z4=R*sin(theta4);scatter3(x(1:5),x3,x4,0,0,y(1:5),y3,y4,0,0,z(1:5),z3,z4,R,-R,filled) %画城市分布t=(0:20)/20;for i=1:4 %画绕飞各城市之间航线X=(1-t)*x(i)+t*x(i

7、+1);Y=(1-t)*y(i)+t*y(i+1);Z=(1-t)*z(i)+t*z(i+1);r=sqrt(X.*X+Y.*Y+Z.*Z);X=R*X./r;Y=R*Y./r;Z=R*Z./r;hold onplot3(X,Y,Z,r,LineWidth,2)endX=(1-t)*x(5)+t*x(5+1); %画北京直飞纽约航线Y=(1-t)*y(5)+t*y(5+1);Z=(1-t)*z(5)+t*z(5+1);r=sqrt(X.*X+Y.*Y+Z.*Z);X=R*X./r;Y=R*Y./r;Z=R*Z./r;hold onplot3(X,Y,Z,b,LineWidth,2)text(x

8、(1),y(1),z(1),北京) %位置标注text(x(2),y(2),z(2),上海)text(x(3),y(3),z(3),东京)text(x(4),y(4),z(4),旧金山)text(x(5),y(5),z(5),纽约)text(x3,y3,z3,成都)text(0,0,R,北极)text(0,0,-R,南极)text(x4,y4,z4,伦敦)title(直飞航程10994公里,绕飞航程15256公里)format ratdistance_1distance_2toc %time over程序运行结果总航程比较:绕飞航程长度 15256 直飞航程长度 10993各城市之间的航程:北京到上海 上海到东京 东京到旧金山 旧金山到纽约 1144 1766 8283 4061 Elapsed time is 1.720780 seconds.航线图示1

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号