%% c=1; nu=1; set(gca,'FontSize',18) set(gca,'LineWidth',2) f = (0:0.2:2).'; v = (-0.3:0.05:0.3); f_matrix =f*ones(size(v)); v_matrix =ones(size(f))*v; u_x = v_matrix; u_y = 1/nu*v_matrix.*(f_matrix-c); quiver(f_matrix,v_matrix,u_x,u_y,1,'LineWidth',2) xlabel('u') ylabel('w') hold on plot([0,2],[0,0],'g','LineWidth',2) axis([0,2,-0.3,0.3]) hold off % print -djpeg kdv_phase_portrait for j = 1:9000; x(j+1) = x(j) + dt*y(j); y(j+1) = y(j) + dt*(c*x(j) - 3*x(j).*x(j)); t(j+1) = t(j) + dt; end % we flow in along the incident manifold. for count = 3000:500:11000 subplot(2,1,1) set(gca,'FontSize',18) set(gca,'LineWidth',2) quiver(f_matrix,v_matrix,u_x,u_y,1,'LineWidth',2) xlabel('f') ylabel('v') 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.5,-1,1]) 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,15,-0.2,2]) xlabel('\zeta') ylabel('f') hold on plot(t(count),x(count),'d','MarkerFaceColor','k','MarkerSize',10) gif_add_frame(gcf,'kdv_wave_solitary.gif',2); hold off end figure clear x y t r=0.0001; x(1) = 0.2; y(1) = 0; dt = 0.001; t(1) = 0; for j = 1:15000; x(j+1) = x(j) + dt*y(j); y(j+1) = y(j) + dt*(c*x(j) - 3*x(j).*x(j)); t(j+1) = t(j) + dt; end delete kdv_wave_cn.gif for count = 3000:500:11000 subplot(2,1,1) set(gca,'FontSize',18) set(gca,'LineWidth',2) quiver(f_matrix,v_matrix,u_x,u_y,1,'LineWidth',2) xlabel('f') ylabel('v') 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(x(count),y(count),'d','MarkerFaceColor','k','MarkerSize',10) axis([-0.2,1.5,-1,1]) plot(x(1:6000),y(1:6000),'c','LineWidth',2) hold off subplot(2,1,2) set(gca,'FontSize',18) set(gca,'LineWidth',2) plot(t,x,'LineWidth',2) % axis([0,15,-0.2,2]) xlabel('\zeta') ylabel('f') hold on plot(t(count),x(count),'d','MarkerFaceColor','k','MarkerSize',10) gif_add_frame(gcf,'kdv_wave_cn.gif',2); hold off end