dt = 0.1;
dx = 1;
dy = 1;

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

c = 1;
D=1;

u = zeros(nx,ny);
u(20:25,20:25) = 1;
%u(1:3, :)=1;

for t = 1:nt
    u2 = u;
    
    %u2 = u2 + rand(nx,ny)>0.99999; %random tüskék just for fun
    
    for i = 2:nx-1
        for j = 2:ny-1
            
            %diff+ lin convection=burgers -> lecseng
        u(i,j) = u2(i,j) + D*dt/dx^2*(u2(i+1,j)-2*u2(i,j)+u2(i-1,j)) - c*dt/dx*(u2(i,j)-u2(i-1,j)) ...
                         + D*dt/dy^2*(u2(i,j+1)-2*u2(i,j)+u2(i,j-1)) - c*dt/dx*(u2(i,j)-u2(i,j-1));
      
       %diff+ reakc=fisher -> utazik
        % u(i,j) = u2(i,j) + D*dt/dx^2*(u2(i+1,j)-2*u2(i,j)+u2(i-1,j)) +c*dt*u2(i,j)*(1-u2(i,j)) ...
         %                 + D*dt/dy^2*(u2(i,j+1)-2*u2(i,j)+u2(i,j-1)) +c*dt*u2(i,j)*(1-u2(i,j));    
        end
    end
%    mesh(u);
    imagesc(u);
    caxis([0 1]); %lecsengés normált színekkel jobban látszódik
    zlim([0 2]);
    xlim([0 100]);
    ylim([0 100]);
    pause(0.01);
end