主程序
clc
b=3;c=12;d=7;e=-0.6;f=-1;
A=[1:0.01:37];
ym=[];
for counter=1:length(A)
a=A(counter)
tspan=1:0.1:500;
var=3;
y0=[1;1;1;1;1];
[t,y]=ode45('chenxt',tspan,y0,[],a,b,c,d,e,f);
j=1;
for i=3000:size(y,1)-1
if y(i-1,var)<y(i,var)&&y(i+1,var)<=y(i,var)
ym(counter,j)=y(i,var);
j=j+1;
end
end
end
plot(t,y)
调用子程序:
function fc=chenxt(t,y)
global a b c d e f
fc=[a*(y(2)-y(1))+y(4);d*y(1)-y(1)*y(3)+c*y(2);y(1)*y(2)-b*y(3)+y(5);y(2)*y(3)-e*y(4);y(3)*y(4)+f*y(5)];
clc
b=3;c=12;d=7;e=-0.6;f=-1;
A=[1:0.01:37];
ym=[];
for counter=1:length(A)
a=A(counter)
tspan=1:0.1:500;
var=3;
y0=[1;1;1;1;1];
[t,y]=ode45('chenxt',tspan,y0,[],a,b,c,d,e,f);
j=1;
for i=3000:size(y,1)-1
if y(i-1,var)<y(i,var)&&y(i+1,var)<=y(i,var)
ym(counter,j)=y(i,var);
j=j+1;
end
end
end
plot(t,y)
调用子程序:
function fc=chenxt(t,y)
global a b c d e f
fc=[a*(y(2)-y(1))+y(4);d*y(1)-y(1)*y(3)+c*y(2);y(1)*y(2)-b*y(3)+y(5);y(2)*y(3)-e*y(4);y(3)*y(4)+f*y(5)];