% propagation movie

clear all;

tau=1; w0=15; k0=w0; k1=1.2; k2=1/5;

x = linspace(-2,18,2001);

t = linspace(0,15,151);

for n=1:5
 for i=1:length(t),
 
  tg = k1*x;

  E = exp(j*(w0*t(i)-k0*x)) .* sqrt(tau^2./(tau^2 + j*k2*x)) .* exp(-(t(i)-tg).^2./(tau^2 + j*k2*x)/2);
  
  plot(x, real(E),'r-', x,abs(E),'b:', x,-abs(E),'b:');
  xlim([-2,17]); set(gca,'xtick',0:5:15);
  ylim([-1.5, 1.5]); set(gca,'ytick',-1:0.5:1); grid;
  xlabel('\itx');

   getframe;

   end
end

close all





