k=0.2;
u(1:180)=0; 
x=linspace(-2,2,180);
h=plot(x,u,'linewidth',3);
axis([-2,2,-0.05,3]);
set(h,'EraseMode','xor')

for at=1:100
    t=at*0.02;
    u=(1./sqrt(4*pi*k*t)).*exp(-x.^2./(4*k*t));
    set(h, 'XData', x, 'YData',u);
    drawnow;
    pause(0.1)
end    