function hyp2
global x0 t0
disp('Initial Value Problem of Hyperbolic PDE')
disp('Model Equation u_t + u u_x = 0')
disp('Initial condition u(x,0) = sin(2*pi*x), x in [0,1] ')
%
time = input('Stopping time ?  (default = 1)  ');
if isempty(time)
   time = 1.;
   end
%
ntime = input('How many output times ?  (default = 10)  ');
if isempty(ntime)
   ntime = 10;
   end
%
dx = 1./100;
x  = 0:dx:1.;
dt = time/ntime;
t = 0:dt:time;
u = sin(2.*pi*x);
plot(x,u)
title(['Solution at time t =',num2str(t(1))]);
M(1) = getframe;
%fname = ['tmp',num2str(1)];
%print('-djpeg',fname)
%
clf
for i=2:length(t)
    t0 = t(i);
    for j=1:length(x)
        x0 = x(j);
        u0 = u(j);
        u(j) = fzero(@burger,u0);
    end
%
    plot(x,u)
    title(['Solution at time t = ',num2str(t(i))]);
    axis([0, 1 , -1, 1]);
%
    M(i) = getframe;
%    fname = ['tmp',num2str(i)];
%    print('-djpeg',fname)
end
movie(M,3)


function fun=burger(u)
global x0 t0
fun = u-sin(2.*pi*(x0-u*t0));
