
% Showing solutions to the wave equation with dispersion

A=1;

x=-10:0.2:10;
t=0:0.2:20;

[X,T]=meshgrid(x,t);

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

subplot(3,2,1)

k=0.5;
z=k*(X-(1-k^2)*T);
Z1=A*cos(z);

surfl(X,T,Z1);
shading interp; colormap(gray);
ylabel('t'); xlabel(''); zlabel('u(x,t)'); view([15 52]);
title('A : k=0.5');
axis([min(x) max(x) min(t) max(t) -2 2])

subplot(3,2,2)

k=0.85;
z=k*(X-(1-k^2)*T);
Z2=A*cos(z);

surfl(X,T,Z2);
shading interp; colormap(gray);
ylabel('t'); xlabel(''); zlabel('u(x,t)'); view([15 52]);
title('B : k=0.85');
axis([min(x) max(x) min(t) max(t) -2 2])

subplot(3,2,3)

k=1.0;
z=k*(X-(1-k^2)*T);
Z3=A*cos(z);

surfl(X,T,Z3);
shading interp; colormap(gray);
ylabel('t'); xlabel(''); zlabel('u(x,t)'); view([15 52]);
title('C : k=1.0');
axis([min(x) max(x) min(t) max(t) -2 2])

subplot(3,2,4)

k=1.1;
z=k*(X-(1-k^2)*T);
Z4=A*cos(z);

surfl(X,T,Z4);
shading interp; colormap(gray);
ylabel('t'); xlabel(''); zlabel('u(x,t)'); view([15 52]);
title('D : k=1.1');
axis([min(x) max(x) min(t) max(t) -2 2])

subplot(3,2,5)

k=1.3;
z=k*(X-(1-k^2)*T);
Z5=A*cos(z);

surfl(X,T,Z5);
shading interp; colormap(gray);
ylabel('t'); xlabel('x'); zlabel('u(x,t)'); view([15 52]);
title('E : k=1.3');
axis([min(x) max(x) min(t) max(t) -2 2])

subplot(3,2,6)

a=1.2;
b=0.8;
c=1.2;
d=1.5;
e=0.7;
Z=a*Z1+b*Z2+c*Z3+d*Z4+e*Z5;

surfl(X,T,Z);
shading interp; colormap(gray);
ylabel('t'); xlabel('x'); zlabel('u(x,t)'); view([15 52]);
title('a*A+b*B+c*C+d*D+e*E');

