
%       Now let us make an animation of the reflected waves.
%       Be patient ...
m=10; % Number of frames
h = newplot; hf=get(h,'Parent'); set(hf,'Renderer','zbuffer')
axis tight, set(gca,'DataAspectRatio',[1 1 1]); axis off
M=moviein(m,hf);
maxu=max(abs(u));
for j=1:m,...
  uu=real(exp(-j*2*pi/m*sqrt(-1))*u);...
  fprintf('%d ',j);...
1   pdeplot(p,e,t,'xydata',uu,'colorbar','off','mesh','off'),...
  caxis([-maxu maxu]);...
  axis tight, set(gca,'DataAspectRatio',[1 1 1]); axis off,...
  M(:,j)=getframe(hf);...
  if j==m,...
  uu=real(exp(-j*2*pi/m*sqrt(-1))*u);...
  fprintf('%d ',j);...
2   pdeplot(p,e,t,'xydata',uu,'colorbar','off','mesh','off'),...
  caxis([-maxu maxu]);...
  axis tight, set(gca,'DataAspectRatio',[1 1 1]); axis off,...
  M(:,j)=getframe(hf);...
  if j==m,...
  uu=real(exp(-j*2*pi/m*sqrt(-1))*u);...
  fprintf('%d ',j);...
3   pdeplot(p,e,t,'xydata',uu,'colorbar','off','mesh','off'),...
  caxis([-maxu maxu]);...
  axis tight, set(gca,'DataAspectRatio',[1 1 1]); axis off,...
  M(:,j)=getframe(hf);...
  if j==m,...
  uu=real(exp(-j*2*pi/m*sqrt(-1))*u);...
  fprintf('%d ',j);...
4   pdeplot(p,e,t,'xydata',uu,'colorbar','off','mesh','off'),...
  caxis([-maxu maxu]);...
  axis tight, set(gca,'DataAspectRatio',[1 1 1]); axis off,...
  M(:,j)=getframe(hf);...
  if j==m,...
  uu=real(exp(-j*2*pi/m*sqrt(-1))*u);...
  fprintf('%d ',j);...
5   pdeplot(p,e,t,'xydata',uu,'colorbar','off','mesh','off'),...
  caxis([-maxu maxu]);...
  axis tight, set(gca,'DataAspectRatio',[1 1 1]); axis off,...
  M(:,j)=getframe(hf);...
  if j==m,...
  uu=real(exp(-j*2*pi/m*sqrt(-1))*u);...
  fprintf('%d ',j);...
6   pdeplot(p,e,t,'xydata',uu,'colorbar','off','mesh','off'),...
  caxis([-maxu maxu]);...
  axis tight, set(gca,'DataAspectRatio',[1 1 1]); axis off,...
  M(:,j)=getframe(hf);...
  if j==m,...
  uu=real(exp(-j*2*pi/m*sqrt(-1))*u);...
  fprintf('%d ',j);...
7   pdeplot(p,e,t,'xydata',uu,'colorbar','off','mesh','off'),...
  caxis([-maxu maxu]);...
  axis tight, set(gca,'DataAspectRatio',[1 1 1]); axis off,...
  M(:,j)=getframe(hf);...
  if j==m,...
  uu=real(exp(-j*2*pi/m*sqrt(-1))*u);...
  fprintf('%d ',j);...
8   pdeplot(p,e,t,'xydata',uu,'colorbar','off','mesh','off'),...
  caxis([-maxu maxu]);...
  axis tight, set(gca,'DataAspectRatio',[1 1 1]); axis off,...
  M(:,j)=getframe(hf);...
  if j==m,...
  uu=real(exp(-j*2*pi/m*sqrt(-1))*u);...
  fprintf('%d ',j);...
9   pdeplot(p,e,t,'xydata',uu,'colorbar','off','mesh','off'),...
  caxis([-maxu maxu]);...
  axis tight, set(gca,'DataAspectRatio',[1 1 1]); axis off,...
  M(:,j)=getframe(hf);...
  if j==m,...
  uu=real(exp(-j*2*pi/m*sqrt(-1))*u);...
  fprintf('%d ',j);...
10   pdeplot(p,e,t,'xydata',uu,'colorbar','off','mesh','off'),...
  caxis([-maxu maxu]);...
  axis tight, set(gca,'DataAspectRatio',[1 1 1]); axis off,...
  M(:,j)=getframe(hf);...
  if j==m,...
    fprintf('done\n');...
done
  end,...
end
%       Show the movie
movie(hf,M,50);
pause % Strike any key to end.

echo off
