dt = 0.1;
dx = 1;

x = 0:dx:100;
nx = length(x);
nt = 1500;

D = 1;

u = zeros(nx,1);
u(20) = 1;

for t = 1:nt
    u2 = u;
    for i = 2:nx-1
        u(i) = u2(i) + D*dt/dx^2*(u2(i+1)-2*u2(i)+u2(i-1)); 
        %dU/dt=dU^2/dx^2 %diff tag csak
    end
    u(1) = 0;
    u(end) = 0;
    plot(u);
    ylim([0 1]);
    pause(0.01);
end