r=2; K=1.4; s=1; c=0.5; a=2; d=0.1; x=-1.2:0.01:2.5; y=0:0.02:4; [X,Y]=meshgrid(x,y); U=r*(1-X/K)-s*Y./(a*X+1); V=c*s*X./(a*X+1)-d; cvals=[0 0]; hold on contour(x,y,U,cvals,'k--'); contour(x,y,V,cvals,'k--'); [T1,Y1] = ode45('predprey',[0 160],[1.5 3.5]); [T2,Y2] = ode45('predprey',[0 160],[1.5 2.5]); [T3,Y3] = ode45('predprey',[0 160],[1.5 1.5]); [T4,Y4] = ode45('predprey',[0 160],[0.1 0.1]); [T5,Y5] = ode45('predprey',[0 200],[0.3 2.2]); [T6,Y6] = ode45('predprey',[0 160],[1.5 0.1]); for i=1:4 [Si,Xi] = ode45('predprey',[0 160],[0.08*i .5*i]); plot(Xi(:,1),Xi(:,2),'g','LineWidth',1); end option=odeset('AbsTol',1e-9,'RelTol',1e-9); plot(Y1(:,1),Y1(:,2),'r','LineWidth',1); plot(Y2(:,1),Y2(:,2),'r','LineWidth',1); plot(Y3(:,1),Y3(:,2),'r','LineWidth',1); plot(Y4(:,1),Y4(:,2),'b','LineWidth',1); plot(Y5(:,1),Y5(:,2),'k','LineWidth',1); plot(Y6(:,1),Y6(:,2),'g','LineWidth',1); xlim([0 1.5]); text(0.8,3.8,'dx/dt=rx(1-x/K)-sxy/(ax+1)','FontSize',12); text(0.8,3.5,'dy/dt=y(csx/(ax+1)-d)','FontSize',12); title('Predator-prey interaction, r=2 K=1.4 s=1 c=0.5 a=2 d=0.1','FontSize',12) xlabel('prey'), ylabel('predator'); ylim([0 4]);