%这个小程序虽然很简单,但可以求非线性动力学或者复杂经济学中经常遇到的类似问题。
%也可以求更高维数的离散系统的bifurcation diagram. 可以根据研究需要,选择分岔图中点的颜色和大小。
clear;
clf;
r=linspace(0,0.5,4000);
t=200;
j=1;
while j p(1)=2;q(1)=1;i=1;
while i p(i+1)=p(i)+0.2*p(i)*[10-2*(0.5+4/3)*p(i)-0.5*q(i)];
q(i+1)=q(i)+r(j)*q(i)*[10-2*(0.5+1)*q(i)-0.5*p(i)];
i=i+1;
end;
a(j)=p(t);
b(j)=p(t-1);
c1(j)=p(t-2);
c2(j)=p(t-3);
c(j)=q(t);
d(j)=q(t-1);
d1(j)=q(t-2);
d2(j)=q(t-3);
j=j+1;
end;
plot(r,a,'LineStyle',':','Color','g');hold on;
plot(r,b,'LineStyle',':','Color','b');hold on;
plot(r,c1,'LineStyle','-','Color','k');hold on;
plot(r,c2,'LineStyle',':','Color','m');hold on;
plot(r,d1,'LineStyle',':','Color','c');hold on;
plot(r,d2,'LineStyle',':','Color','r');hold on;
plot(r,c,'LineStyle',':','Color','y');hold on;
plot(r,d,'LineStyle',':','Color','g')