dt = 0.1;
dx = 1;

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

c = 1;

u = zeros(nx,1);
u(19:20) = 1;
%u = u+1;
%u(1)=1;
for t = 1:nt
    u2 = u;
    for i = 2:nx-1
        u(i) = u2(i) - c*dt/dx*(u2(i)-u2(i-1)); %c=U(i) ??
        %dU/dt=-c*dU/dx %lin convection
    end
    %u(1) = 1;
    u(end) = 0;
    plot(u);
    ylim([0 1]);
    pause(0.01);
end