%
% make a movie, visualizing the solution of u_tt=u_xx+u_yy
%
N=64;
x1=[0:N]/N;
y1=x1;
[x,y]=meshgrid(x1,y1);
%
figure(1)
set(gcf,'position',[50, 100, 550, 450])
%
movObj=QTWriter('movie_2.mov');
    % open a file for writing the movie
nframe=140;   % number of frames
dt=sqrt(2)/140;   % time increment for each frame
%
for n=1:nframe,
  T=(n-1)*dt;
  u=sin(pi*x).*sin(pi*y).*cos(sqrt(2)*pi*T)+...
    sin(2*pi*x).*sin(2*pi*y).*cos(sqrt(2)*2*pi*T);
  clf reset
  axes('position',[0.15, 0.12, 0.80,0.80])
  h=surf(x,y,u);
  set(h,'edgecolor',[0.4,0.4,0.4])
  set(gca,'fontsize',14)
  axis([0, 1, 0, 1, -1.4, 1.4])
  xlabel('x')
  ylabel('y')
  zlabel('u(t)')
  drawnow
  writeMovie(movObj,getframe(gcf));
end
%
close(movObj);   % close the file
%
%
