%
%  w02char.m -- (djm:  10 jan 2006)
%    - two-way wave:
%          u_tt - c^2(x) u_xx = 0
%

%a = 0.93;
a = -0.32;

figure(1);  clf;  hold on

c = +1;

x = -2*pi:pi/10:0;  t = 0:0.25:8;
[xx,tt] = meshgrid(x,t);

contour(x,t,xx-c*tt,[-13:1:0],'b')

x = 0:pi/10:pi;  t = 0:0.25:8;
[xx,tt] = meshgrid(x,t);

contour(x,t,xx-c*tt + a*(1-cos(xx)),[-8:1:4],'r')

x = pi:pi/10:3*pi;  t = 0:0.25:8;
[xx,tt] = meshgrid(x,t);

contour(x,t,xx-c*tt + 2*a,[-6:1:10],'b')

c = -1;

x = -2*pi:pi/10:0;  t = 0:0.25:8;
[xx,tt] = meshgrid(x,t);

contour(x,t,xx-c*tt,[-5:1:7],'b--')

x = 0:pi/10:pi;  t = 0:0.25:8;
[xx,tt] = meshgrid(x,t);

contour(x,t,xx-c*tt + a*(1-cos(xx)),[0:1:12],'r--')

x = pi:pi/10:3*pi;  t = 0:0.25:8;
[xx,tt] = meshgrid(x,t);

contour(x,t,xx-c*tt + 2*a,[3:1:19],'b--')

axis([-2*pi 3*pi 0 8])

title('\bf characteristics for the ''two-way'' wave equation')
xlabel('\bf x-axis');  ylabel('\bf t-axis')