%
% make a movie, visualizing the solution of u_tt=u_xx
%
N=1024;
x=[0:N]/N;
u0=(x>=2/6 & x<3/6).*sin(6*pi*(x-2/6)).^2;
    % u0 = initial displacement of string
ut0=0*x;   % initial velocity of string
%
figure(1)
set(gcf,'position',[50, 100, 700, 400])
%
movObj=QTWriter('movie_1.mov');
    % open a file for writing the movie
nframe=250;   % number of frames
dt=0.008;   % time increment for each frame
%
for n=1:nframe,
  u=solv_1d_wave(u0, ut0, (n-1)*dt);
  clf reset
  axes('position',[0.10, 0.15, 0.85,0.75])
  plot(x, u,'b-','linewidth',2.0);
  set(gca,'fontsize',14)
  axis([0, 1, -1.1, 1.1])
  xlabel('x')
  ylabel('u(t)')
  drawnow
  writeMovie(movObj,getframe(gcf));
end
%
close(movObj);   % close the file
%
%