nl=6;
nc=5;
t123=100;
t4=50;
tv=zeros(nl,nc);
tv(1,:)=t123+zeros(1,nc);
tv(:,1)=t123+zeros(nl,1);
tv(:,nc)=t123+zeros(nl,1);
tv(nl,:)=t4+zeros(1,nc);
tn=tv;
for m=2:nl-1
for n=2:nc-1
tn(m,n)=(tv(m-1,n)+tv(m,n-1)+tv(m,n+1)+tv(m+1,n))/4
end
end
mesh(tn)