% evolve a gaussian wavepacket with c_g .ne. c (no distortion effects included)

c=2;cg=1;k=8;sigma=1;
x=-10:0.1:10;
t=-8;
y=exp(-(x-cg*t).^2/2/sigma).*sin(k*(x-c*t));
h=plot(x,y); axis equal, set(gca,'XLim',[-10,10],'YLim',[-1 1])
set(h,'EraseMode','xor')

pause

for t=-8:0.03:8
    drawnow
    y=exp(-(x-cg*t).^2/2/sigma).*sin(k*(x-c*t));
    set(h,'Ydata',y)
    pause(0.05)
end
