|
楼主 |
发表于 2008-7-30 11:18
|
显示全部楼层
这是我编的画poincare截面的程序,请学长帮我指导一下看看哪里不太对,麻烦学长了!
%poincare截面绘制
clear;
options=odeset('RelTol',1e-10);
tall=1;
h=0.01;
tt=1;
k=tall/tt;
t=[];
x=[];
x1=[];
x2=[];
x3=[];
n=input('输入n值n=');%输入n的值,n要大于1,因为等于1时一个点都画不出来,因为T=3/20>t=1/10
i=1;
[t1,x1]=ode15s(@dafen1,[(i-1)*tt:h:1/4*tt+(i-1)*tt],[0,0,0,0,0,0,0,0,0,0],[]);
t=[t;t1];
x=[x;x1];
[t2,x2]=ode15s(@dafen2,[1/4*tt+(i-1)*tt+h:h:3/4*tt+(i-1)*tt],x1((1/4*tt)/h,:),[]);
t=[t;t2];
x=[x;x2];
[t3,x3]=ode15s(@dafen1,[3/4*tt+(i-1)*tt+h:h:tt+(i-1)*tt],x2((1/2*tt)/h,:),[]);
t=[t;t3]
x=[x;x3];
for i=2:n
[t1,x1]=ode15s(@dafen1,[(i-1)*tt+h:h:1/4*tt+(i-1)*tt],x3((1/4*tt)/h,:),[]);
t=[t;t1];
x=[x;x1];
[t2,x2]=ode15s(@dafen2,[1/4*tt+(i-1)*tt+h:h:3/4*tt+(i-1)*tt],x1((1/4*tt)/h,:),[]);
t=[t;t2];
x=[x;x2];
[t3,x3]=ode15s(@dafen1,[3/4*tt+(i-1)*tt+h:h:tt+(i-1)*tt],x2((1/2*tt)/h,:),[]);
t=[t;t3]
x=[x;x3];
x1;
x2;
x3;
end
x;
T=3/20;
j=1;
ypoin=[];
for k=1:n*tt/T+1
ypoin(k,:)=x(j,:);
j=j+T/h;
end
ypoin;
subplot(3,3,1)
plot(ypoin(:,3),ypoin(:,5),'k.')
hold on
subplot(3,3,2)
plot(ypoin(:,4),ypoin(:,6),'k.')
hold on
subplot(3,3,3)
plot(ypoin(: ,7),ypoin(: ,9),'k.')
hold on
subplot(3,3,4)
plot(ypoin(:,8),ypoin(:,10),'k.')
hold on
subplot(3,3,5)
plot(x(:,3),x(:,5),'k')
hold on
subplot(3,3,6)
plot(x(:,4),x(:,6),'k')
hold on
subplot(3,3,7)
plot(x(: ,7),x(: ,9),'k')
hold on
subplot(3,3,8)
plot(x(:,8),x(:,10),'k') |
|