Nodo (1,1) $$ \begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{1-1, 1} - 4 T_{1, 1} + T_{1+1, 1} + T_{1, 1-1} + T_{1, 1+1} &= 0 \\ T_{0, 1} - 4 T_{1, 1} + T_{2, 1} + T_{1, 0} + T_{1, 2} &= 0 \end{align*} $$
Nodo (2,1) $$ \begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{2-1, 1} - 4 T_{2, 1} + T_{2+1, 1} + T_{2, 1-1} + T_{2, 1+1} &= 0 \\ T_{1, 1} - 4 T_{2, 1} + T_{3, 1} + T_{2, 0} + T_{2, 2} &= 0 \end{align*} $$
Nodo (3,1) $$ \begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{3-1, 1} - 4 T_{3, 1} + T_{3+1, 1} + T_{3, 1-1} + T_{3, 1+1} &= 0 \\ T_{2, 1} - 4 T_{3, 1} + T_{4, 1} + T_{3, 0} + T_{3, 2} &= 0 \end{align*} $$
Nodo (1,2) $$ \begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{1-1, 2} - 4 T_{1, 2} + T_{1+1, 2} + T_{1, 2-1} + T_{1, 2+1} &= 0 \\ T_{0, 2} - 4 T_{1, 2} + T_{2, 2} + T_{1, 1} + T_{1, 3} &= 0 \end{align*} $$
Nodo (2,2) $$ \begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{2-1, 2} - 4 T_{2, 2} + T_{2+1, 2} + T_{2, 2-1} + T_{2, 2+1} &= 0 \\ T_{1, 2} - 4 T_{2, 2} + T_{3, 2} + T_{2, 1} + T_{2, 3} &= 0 \end{align*} $$
Nodo (3,2) $$ \begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{3-1, 2} - 4 T_{3, 2} + T_{3+1, 2} + T_{3, 2-1} + T_{3, 2+1} &= 0 \\ T_{2, 2} - 4 T_{3, 2} + T_{4, 2} + T_{3, 1} + T_{3, 3} &= 0 \end{align*} $$
Nodo (1,3) $$ \begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{1-1, 3} - 4 T_{1, 3} + T_{1+1, 3} + T_{1, 3-1} + T_{1, 3+1} &= 0 \\ T_{0, 3} - 4 T_{1, 3} + T_{2, 3} + T_{1, 2} + T_{1, 4} &= 0 \end{align*} $$
Nodo (2,3) $$ \begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{2-1, 3} - 4 T_{2, 3} + T_{2+1, 3} + T_{2, 3-1} + T_{2, 3+1} &= 0 \\ T_{1, 3} - 4 T_{2, 3} + T_{3, 3} + T_{2, 2} + T_{2, 4} &= 0 \end{align*} $$
Nodo (3,3) $$ \begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{3-1, 3} - 4 T_{3, 3} + T_{3+1, 3} + T_{3, 3-1} + T_{3, 3+1} &= 0 \\ T_{2, 3} - 4 T_{3, 3} + T_{4, 3} + T_{3, 2} + T_{3, 4} &= 0 \end{align*} $$
Sistema de ecuaciones del problema $$ \begin{align*} - 4 T_{1, 1} + T_{1, 2} + T_{2, 1} &= -75 \\ T_{1, 1} - 4 T_{2, 1} + T_{2, 2} + T_{3, 1} &= 0 \\ T_{2, 1} - 4 T_{3, 1} + T_{3, 2} &= -50 \\ T_{1, 1} - 4 T_{1, 2} + T_{1, 3} + T_{2, 2} &= -75 \\ T_{1, 2} + T_{2, 1} - 4 T_{2, 2} + T_{2, 3} + T_{3, 2} &= 0 \\ T_{2, 2} + T_{3, 1} - 4 T_{3, 2} + T_{3, 3} &= -50 \\ T_{1, 2} - 4 T_{1, 3} + T_{2, 3} &= -175 \\ T_{1, 3} + T_{2, 2} - 4 T_{2, 3} + T_{3, 3} &= -100 \\ T_{2, 3} + T_{3, 2} - 4 T_{3, 3} &= -150 \end{align*} $$
en forma matricial presenta una matriz dispersa $$ \begin{equation*} \begin{bmatrix} -4 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & -4 & 1 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & -4 & 1 & 0 \\ 1 & -4 & 1 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 & -4 & 1 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 1 & -4 & 1 \\ 0 & 1 & -4 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 & -4 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 1 & -4 \end{bmatrix} \begin{bmatrix} T_{1,1} \\ T_{1,2} \\ T_{1,3} \\ T_{2,1} \\ T_{2,2} \\ T_{2,3} \\ T_{3,1} \\ T_{3,2} \\ T_{3,3} \end{bmatrix} = \begin{bmatrix} -75 \\ 0 \\ -50 \\ -75 \\ 0 \\ -50 \\ -175 \\ -100 \\ -150 \end{bmatrix} \end{equation*} $$
en forma reducida $$ \begin{equation*} Ax = B \end{equation*} $$
A = [[-4 1 0 1 0 0 0 0 0],
[ 1 0 0 -4 1 0 1 0 0],
[0 0 0 1 0 0 -4 1 0],
[1 -4 1 0 1 0 0 0 0],
[0 1 0 1 -4 1 0 1 0],
[0 0 0 0 1 0 1 -4 1],
[0 1 -4 0 0 1 0 0 0],
[0 0 1 0 1 -4 0 0 1],
[0 0 0 0 0 1 0 1 -4]];
B = [[-75],
[0],
[-50],
[-75],
[0],
[-50],
[-175],
[-100],
[-150]];
x = inv(A)*B;
x = transpose(reshape(x,3,3))
for i=1:3
for j=1:3
println("T[$i,$j] = $(x[i,j])")
end
end
T[1,1] = 42.85714285714286
T[1,2] = 63.16964285714287
T[1,3] = 78.57142857142857
T[2,1] = 33.25892857142858
T[2,2] = 56.25000000000001
T[2,3] = 76.11607142857143
T[3,1] = 33.92857142857144
T[3,2] = 52.45535714285715
T[3,3] = 69.64285714285714