[转帖]单摆运动的分岔M-file
该程序计算起来很慢 <BR><TABLEcellSpacing=0 cellPadding=10 width="90%">
<TR>
<TD bgColor=#eeeeee><FONT face="Courier New"><BR><FONT color=#ff9933><BR>clc; <BR>kk=20; <BR>NN=64; <BR>c1=0.5;c3=2/3; <BR>t=2*pi/c3; <BR>c2=.98;n=1; <BR>Fun1=inline('y2','x','y2'); <BR>Fun2=inline('c2*cos(c3*x)-c1*y2-sin(y1)',... <BR> 'x','y1','y2','c1','c2','c3'); <BR>H=t/NN; <BR>% while 1; <BR>b=.3; <BR>y1=.1;y2=0; <BR>F=[];y=[]; <BR>j=0;x=0; <BR>Y=0.1; <BR>tt=1; <BR>while c2<=1.2; <BR> y1=.1;y2=0;Y=0.1;j=0;x=0; <BR> while y1<1.6; <BR> y2=0;y1=Y; <BR> for k=1:kk <BR> for i=1:NN; <BR> K1=H*Fun1(x,y2); <BR> L1=H*Fun2(x,y1,y2,c1,c2,c3); <BR> K2=H*Fun1(x+H/2,y2+L1/2); <BR> L2=H*Fun2(x+H/2,y1+K1/2,y2+... <BR> L1/2,c1,c2,c3); <BR> K3=H*Fun1(x+H/2,y2+L2/2); <BR> L3=H*Fun2(x+H/2,y1+K2/2,y2+... <BR> L2/2,c1,c2,c3); <BR> K4=H*Fun1(x+H,y2+L3/2); <BR> L4=H*Fun2(x+H,y1+K3/2,y2+... <BR> L3/2,c1,c2,c3); <BR> y1=y1+(K1+2*(K2+K3)+K4)/6; <BR> y2=y2+(L1+2*(L2+L3)+L4)/6; <BR> x=x+H; <BR> if k==kk & i==8; <BR> y=;F=;Y=Y+b; <BR> end <BR> end <BR> end <BR> length(y) <BR> end <BR> c2=c2+0.0005; <BR> n=n+1; <BR>end <BR>figure; <BR>plot(F,y,'.','markersize',2) <BR></FONT></FONT></TD></TR></TABLE> 见过
页:
[1]