
% Ploting a movie of a 2D KdV soliton

x=-10:0.2:15;
y=-10:0.2:10;

[X,Y]=meshgrid(x,y);

set(gca,'FontSize',[16]);
figure(2)
clf

k=2;
l=1;
w=k^3+3*l^2/k;

t=0;
x0=0;


Z = (k^2/2)*sech(0.5*(k*X+l*Y-w*t*ones(length(x),length(y))'-x0)).^2;
surfl(X,Y,Z);
shading interp
colormap(gray)
title(['2D soliton solution for the KdV; t=' num2str(t)])
ylabel('y')
xlabel('x')
zlabel('u(x,y)')
view([15 66])


fprintf('Press any key...\n');
pause

for t=0:0.05:2
 Z = (k^2/2)*sech(0.5*(k*X+l*Y-w*t*ones(length(x),length(y))'-x0)).^2;
 surfl(X,Y,Z);
 shading interp
 colormap(gray)
 title(['2D soliton solution for the KdV; t=' num2str(t)])
 ylabel('y')
 xlabel('x')
 zlabel('u(x,y)')
 view([15 66])
 pause(0.001)
end

