% load the data >> load KdV.mat % here is a solution of the initial value problem with soliton initial data. % note that the solution rigidly translates, as expected. >> figure(1) >> clf >>for j=1:31, plot(x,u2(:,j)); axis([0,2*pi,0,150]); pause(1); end % here, I gave the solition initial data to two equations. First, I gave % it to the KdV equation and computed a solution. Then I gave it to the % Airy equation (u_t + u_xxx = 0) and computed a solution. In the following % I plot the solutions at equal times. Note the effect of dispersion. >> figure(2) >> clf >> for j=1:31, plot(x,u2(:,j)); hold on; plot(x,U2(:,j)); axis([0,2*pi,-50,150]); hold off; pause(1); end % Here, I took as initial data the sum of two soliton profiles with a short % fat soliton in front of a tall thin soliton. This initial data was given % to the KdV code. Note the soliton interaction. >> figure(3) >> clf >> for j=1:31, plot(x,u3(:,j)); axis([0,2*pi,0,150]); pause(1); end % Here, I plot the above solution, while also plotting in red what the % solitons would've done in the absence of any interaction. Note that % the tall, thin solition is advanced as a result of the interaction and % the short, fat soliton is retarded. >> figure(4) >> clf >> for j=1:31, plot(x,u3(:,j)); hold on; plot(x,u1(:,j),'r'); plot(x,u2(:,j),'r'); axis([0,2*pi,0,150]); hold off; pause(1); end