“三体”问题就已经不能解析求解了, “多体”问题即使计算机模拟也不好做。但如果你利用"万有引力定律",并考虑"力的叠加原理"进行模拟,也许可行. "对彗星的质量,初始位置和处速度"这可能要查一下专业的天体资料,比如哈雷慧星的记录资料.
下面是一个 模拟地、日、月运动 的程序,转自萝卜。
作个参考:
% 模拟太阳系运动
t=linspace(0,2*pi,100);
fill(cos(t),sin(t),'r');
hold on;
plot(4*cos(t),sin(t)*4,'k');
set(gca,'position',[0 0.11 0.775 0.815])
a=0.1;b=0;
xe=4*cos(a)+cos(t)*0.6;
ye=4*sin(a)+sin(t)*0.6;
He=fill(xe,ye,'b');
xm=4*cos(a)+cos(b);
ym=4*sin(a)+sin(b);
set(gcf,'doublebuffer','on');
Hm=plot(xm,ym,'c.','markersize',24);
aa=gca;
axis([-6,6,-6,6]);
axis square;
k=1;da=0.1;db=0.5;
xlabel('Please press "space" key and stop this program!',...
'fontsize',12,'color','r');
title('simulate solar system')
axes('position',[0.75,0.11,0.25,0.8]);
fill(0.2+cos(t)*0.18,0.75+sin(t)*0.08,'r');
ylim([0,1]);xlim([0,0.9]);
text(0.5,0.75,'Sun');hold on;
fill(0.2+cos(t)*0.11,0.5+sin(t)*0.05,'b');
text(0.5,0.5,'Earth');
plot(0.2,0.3,'c.','markersize',24);
text(0.5,0.3,'Moon');
axis off
axes(aa);
while k;
s=get(gcf,'currentkey');
if strcmp(s,'space');
clc;k=0;
end
a=a+da;
b=b+db;
xe=4*cos(a)+cos(t)*0.6;
ye=4*sin(a)+sin(t)*0.6;
xm=4*cos(a)+cos(b);
ym=4*sin(a)+sin(b);
set(He,'xdata',xe,'ydata',ye);
set(Hm,'xdata',xm,'ydata',ym);
pause(0.1);
if a<80;
plot(xm,ym);
end
end
figure(gcf);
[ 本帖最后由 xjzuo 于 2006-11-12 13:30 编辑 ] |