# MATLAB Heat Transfer 2D Steady State Explicit

Hello. I am completely new to MATLAB and programming in general. I never thought I would have to resort to online help, but here I am. I have spent hours googling and haven't been able to get very far.

1. Homework Statement

Calculate the distribution of the temperature of the inner part of the model.
Thermal conductivity: λ = 47 W/(m*K)
Specific heat capacity: cp = 465 J/(kg*K)
Density: ρ = 7,85 kg/m^3
Length of one side of a cell: L = 0,05 m
Starting temperature of model: T0 = 0 °C

A:
Wall temperature: Tw = 500 °C

B:
Fluid temperature: Tf = 20 °C
Heat transfer coefficient: α = 500 W/(m^2*K)

Image of the model:

## Homework Equations

Here T_i,j is supposed to be the temperature of the cell in question, whereas the T_{i+1,j} should be known.

## The Attempt at a Solution

Yes I know it's a rather weak attempt, as I stated earlier, I'm new to programming in general, any further attempts would look like the work of a chimpanzee, ergo pointless.
Code:
% Given variables
lambda = 47 % Thermal conductivity [W/(m*K)]
cp = 465 % Specific heat capacity [J/(kg*K)]
rho = 7.85 % Density [kg/m^3]
L = 0.05 % Length of one side of a cell [m]
T0 = 0 % Starting temperature of the model [°C]

%Boundary condition A
Tw = 500 % Wall temperature [°C]

%Boundary condition B
Tf = 20 % Fluid temperature [°C]
alfa = 500 % Heat transfer coefficient [W/(m^2*K)]

model =  [0  0  Tf 0  Tf 0  Tf 0  0  0  % model matrix, an attempt
0  Tf T0 Tf T0 Tf T0 Tf 0  0
Tw T0 T0 Tf T0 Tf T0 Tf Tf 0
Tw T0 T0 T0 T0 T0 T0 T0 T0 Tf
0  Tf T0 T0 T0 T0 Tf Tf Tf 0
0  Tf T0 T0 T0 T0 Tf Tf Tf 0
Tw T0 T0 T0 T0 T0 T0 T0 T0 Tf
Tw T0 T0 Tf T0 Tf T0 Tf Tf 0
0  Tf T0 Tf T0 Tf T0 Tf 0  0
0  0  Tf 0  Tf 0  Tf 0  0  0];

mean = ( ...  %Should I use something like this for the equation?
sum (  ) ...
+ sum (  ) ...
+ sum (  ) ...
+ sum (  ) ) ...
/ ( 2 * m + 2 * n - 4 );
If the images aren't visible I'll upload them externally and link to them.