function hmgd
figure
for j=1:3
time1=[2.3;2.1;2.3];
time2=[2.3;2.1;0.84];
v=[2.1;3.5;2.74];
[t1,z1]=ode45('hmgdfun',[0:0.01:time1(j)],[10,0,0,2.98],[],8900);
[t2,z2]=ode45('hmgdfun',[0:0.01:time1(j)],[7.2,0,(pi*(0.01-1/3)),4.88],[],8900);
[t3,z3]=ode45('hmgdfun',[0:0.01:time2(j)],[10,0,0,v(j)],[],8900);
[x1,u1]=pol2cart(z1(:,3),z1(:,1));
[x2,u2]=pol2cart(z2(:,3),z2(:,1));
[x3,u3]=pol2cart(z3(:,3),z3(:,1));
plot(x1(:),u1(:),'y',x2(:),u2(:),'y',x3(:),u3(:),'b')
hold on
axis off
sun=line(0,0,'color','r','erasemode','xor','marker','.','markersize',80);
earth=line(10,0,'color','b','marker','.','erasemode','xor','markersize',40);
venus=line(7.2,0,'color','m','marker','.','erasemode','xor','markersize',30);
ship=line(10,0,'color','r','marker','p','erasemode','xor','markersize',10);
if j==1
view(0,58);
title('霍曼轨道');
text(-10,-10,-1,'方位角:0度;仰角:58度');
text(-4,19,1,'依次为太阳,地球,金星,飞船');
text(-8,32,1,'当飞船速度小于相切速度时,飞船可以与金星');
text(-10,28,1,'轨道相交。虽然这是飞船可能与金星相遇,但飞船');
text(-10,24,1,'要降在金星上,它的速度需要改变很大,需要极大的能量。');
sun00=line(-8,35,'color','r','marker','.','markersize',18);
earth11=line(-7,35,'color','b','marker','.','markersize',14);
venus22=line(-6,35,'color','m','marker','.','markersize',12);
ship33=line(-5,35,'color','r','marker','p','markersize',10);
elseif j==2
view(-90,50);
text(-65,16,1,'方位角:-90度;仰角:50度');
text(-4,8,1,'以此为太阳,地球,金星,飞船');
text(-1,15,1,'当飞船速度大于相切速度时,飞船的轨道将不与金星轨道相交。');
sun00=line(-4,12,1,'color','r','marker','.','markersize',18);
earth11=line(-4,11,1,'color','b','marker','.','markersize',14);
venus22=line(-4,10,1,'color','m','marker','.','markersize',12);
ship33=line(-4,9,1,'color','r','marker','p','markersize',10);
else j==3
view(1,54)
text(-10,-10,-1,'方位角:1度;仰角:54度');
text(-6,12,1,'依次为太阳,地球,金星,飞船');
text(-10,16,1,'当飞船速度等于相切速度时,飞船的轨道将与金星轨道相切。');
sun00=line(-10,27,'color','r','marker','.','markersize',18);
earth11=line(-9,27,'color','b','marker','.','markersize',14);
venus22=line(-8,27,'color','m','marker','.','markersize',12);
ship33=line(-7,27,'color','r','marker','p','markersize',10);
end
n1=length(t3);
for i=1:n1
set(earth,'xdata',x1(i),'ydata',u1(i));
set(venus,'xdata',x2(i),'ydata',u2(i));
set(ship,'xdata',x3(i),'ydata',u3(i));
drawnow;
pause(0.1);
end
if j==3
n2=length(t2);
for i=86:n2
set(earth,'xdata',x1(i),'ydata',u1(i));
set(venus,'xdata',x2(i),'ydata',u2(i));
set(ship,'xdata',x2(i),'ydata',u2(i));
drawnow;
pause(0.1);
end
end
cla
end
评论2
最新资源