%
%  w01char.m -- (djm:  10 jan 2006)
%    - one-way wave:
%          u_t - a tanh(x) u_x = 0
%

x = -5:0.1:5;  t = 0:0.1:2;
[xx,tt] = meshgrid(x,t);

a = +1;
figure(1);  clf
contour(x,t,sinh(xx).*exp(a*tt),sinh(-10:0.5:10),'b')
title('\bf characteristics (a = +1)')
xlabel('\bf x-axis');  ylabel('\bf t-axis')

a = -1;
figure(2);  clf
contour(x,t,sinh(xx).*exp(a*tt),sinh(-10:0.5:10),'b')
title('\bf characteristics (a = -1)')
xlabel('\bf x-axis');  ylabel('\bf t-axis')

%  gaussian IVs
a = +1;
xe = -5:0.02:5;  te = 2;
x0 = asinh(exp(a*te)*sinh(xe));

figure(3);  clf;
subplot(2,1,1);  hold on
plot(xe,exp(-(2*xe).^2),'b--')
plot(xe,exp(-(2*x0).^2),'b')

plot(xe,exp(-(2*(xe-4)).^2),'r--')
plot(xe,exp(-(2*(x0-4)).^2),'r')

plot(xe,exp(-(2*(xe+2)).^2),'k--')
plot(xe,exp(-(2*(x0+2)).^2),'k')

xlabel('\bf x-axis');  ylabel('\bf u(x,0) and u(x,2) for a=+1')

a = -1;
xe = -5:0.02:5;  te = 2;
x0 = asinh(exp(a*te)*sinh(xe));

subplot(2,1,2);  hold on
plot(xe,exp(-((xe-1)).^2),'k--')
plot(xe,exp(-((x0-1)).^2),'k')

xlabel('\bf x-axis');  ylabel('\bf u(x,0) and u(x,2) for a=-1')
