close all clear all clc set(gca,'FontSize',18) set(gca,'LineWidth',2) v = 2; beta = (-0.2:0.1:1.2).'; gamma = (-0.5:0.1:0.5); beta_matrix =beta*ones(size(gamma)); gamma_matrix =ones(size(beta))*gamma; u_x = gamma_matrix; u_y = -v*gamma_matrix - beta_matrix.*(1-beta_matrix); quiver(beta_matrix,gamma_matrix,u_x,u_y,1,'LineWidth',2) xlabel('\beta') ylabel('\gamma') hold on plot(1,0,'o','MarkerFaceColor','r','MarkerSize',10) plot(0,0,'o','MarkerFaceColor','g','MarkerSize',10) M = [0,1,;1,-2]; [V,D] = eig(M); r=0.1; plot_arrow(1,0,1+r*V(1,2),r*V(2,2),... 'linewidth',2,'headwidth',0.25,'headheight',0.33) plot_arrow(1,0,1-r*V(1,2),-r*V(2,2),... 'linewidth',2,'headwidth',0.25,'headheight',0.33) plot_arrow(1+r*V(1,1),r*V(2,1),1,0,... 'linewidth',2,'headwidth',0.25,'headheight',0.33) plot_arrow(1-r*V(1,1),-r*V(2,1),1,0,... 'linewidth',2,'headwidth',0.25,'headheight',0.33) axis([-0.2,1.2,-0.5,0.5]) hold off print -djpeg r_d_phase_portrait % now we solve for the heteroclinic connection using Euler's method r=0.0001; x(1) = 1+r*V(1,2); y(1) = r*V(2,2); dt = 0.01; t(1) = 0; for j = 1:4000; x(j+1) = x(j) + dt*y(j); y(j+1) = y(j) + dt*(-v*y(j) - x(j).*(1-x(j))); t(j+1) = t(j) + dt; end delete r_d_wave.gif for count = 1:100:length(t) subplot(2,1,1) set(gca,'FontSize',18) set(gca,'LineWidth',2) quiver(beta_matrix,gamma_matrix,u_x,u_y,1,'LineWidth',2) xlabel('\beta') ylabel('\gamma') hold on plot(1,0,'o','MarkerFaceColor','r','MarkerSize',10) plot(0,0,'o','MarkerFaceColor','g','MarkerSize',10) M = [0,1,;1,-2]; [V,D] = eig(M); r=0.1; % plot_arrow(1,0,1+r*V(1,2),r*V(2,2),... % 'linewidth',2,'headwidth',0.25,'headheight',0.33) % plot_arrow(1,0,1-r*V(1,2),-r*V(2,2),... % 'linewidth',2,'headwidth',0.25,'headheight',0.33) % % plot_arrow(1+r*V(1,1),r*V(2,1),1,0,... % 'linewidth',2,'headwidth',0.25,'headheight',0.33) % plot_arrow(1-r*V(1,1),-r*V(2,1),1,0,... % 'linewidth',2,'headwidth',0.25,'headheight',0.33) plot(x(count),y(count),'d','MarkerFaceColor','k','MarkerSize',10) axis([-0.2,1.2,-0.5,0.5]) plot(x,y,'c','LineWidth',2) hold off subplot(2,1,2) set(gca,'FontSize',18) set(gca,'LineWidth',2) plot(t,x,'LineWidth',2) axis([0,40,-0.2,1.2]) xlabel('y') ylabel('\beta') hold on plot(t(count),x(count),'d','MarkerFaceColor','k','MarkerSize',10) gif_add_frame(gcf,'r_d_wave.gif',2); hold off end