Here's another code that I copied somewhere. Does it answer to the question? I need interpretation. Which 2 codes should I follow? Sorry, I'm a newbie.
Lx=1; Ly=1;
Nx=10; Ny=10;
nx=Nx+1 ; ny=Ny+1;
dx=Lx/Nx; dy=Ly/Ny;
x=(0:Nx)*dx; y=(0:Ny)*dy;
boundary_index= [ 1:nx, 1:nx:1+(ny-1)*nx,
1+(ny-1)*nx:nx*ny, nx:nx:nx*ny ];
diagonals= [4*ones(nx*ny,1), -ones(nx*ny,4)];
A=spdiags(diagonals, [0 -1 1 -nx nx], nx*ny, nx*ny);
I=speye(nx*ny);
A(boundary_index,:)= I(boundary_index,:);
b=zeros(nx,ny);
b(:,1)=0;
b(1,:)=0;
b(:,ny)=1;
b(nx,:)=0;
b= reshape(b,nx*ny,1);
Phi= A\b;
Phi=reshape(Phi,nx,ny);
[X,Y]= meshgrid(x,y);
v=[0.8 0.6 0.4 0.2 0.1 0.05 0.01];
contour(X,Y,Phi',v,'ShowText','on');
axis equal;
set(gca,'YTick', [0 0.2 0.4 0.6 0.8 1]);
set(gca,'XTick',[0 0.2 0.4 0.6 0.8 1]);
xlabel('$x$','Interpreter', 'latex', 'FontSize', 14);
ylabel('$y$','Interpreter','latex', 'FontSize', 14);
title('Solution of 1b' ,'Interpreter','latex','FontSize',16);