x=0:.01:50;

plot(x,20*ones(size(x)),'LineWidth',2);
axis([0,50,0,21]);
hold on;
xlabel('x','FontName','Times','FontSize',14);
ylabel('Temperature u','FontName','Times','FontSize',14);
set(gca,'FontName','Times','FontSize',18);
pause;

ts = [1,100:100:300,1000,10000];

for jj = 1:length(ts)
    t = ts(jj);
    u = zeros(size(x));
    for n=1:100
        u = u + 80/pi/(2*n-1)*exp(-(2*n-1)^2*t/2500)*sin((2*n-1)*pi*x/50);
    end
    plot(x,u,'LineWidth',2);
    hold on;
    set(gca,'FontName','Times','FontSize',18);
    pause;
end
legend('t=1','t=100','t=200','t=300','t=1000','t=10000','Location','SouthEast');



