
% Showing sample solutions to the wave equation

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

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

figure(1)

set(gca,'FontSize',[16]);
subplot(2,1,1)
c=0.25;
z=X-c*T;
%Z=sin(z)./z;
Z=cos(z);

surfl(X,T,Z);
shading interp
colormap(gray)
ylabel('t')
xlabel('x')
zlabel('u(x,t)')
view([20 60])
title('u(x,t)=f(x-ct)')


set(gca,'FontSize',[16]);
subplot(2,1,2)
c=-0.25;
z=X-c*T;
%Z=sin(z)./z;
Z=cos(z);

surfl(X,T,Z);
shading interp
colormap(gray)
ylabel('t')
xlabel('x')
zlabel('u(x,t)')
view([20 60])
title('u(x,t)=f(x+ct)')

