n = 20;
u = zeros(n);
u(end,:) = ones(1,n);

for i = 1:200
  for j = 2:n-1
    for k = 2:n-1
      u(j,k) = 0.25*(u(j+1,k)+u(j-1,k)+u(j,k+1)+u(j,k-1));
    endfor   
  endfor   
endfor

mesh(u)
