# Heat Transfer: Finite Difference method using MATLAB

## Homework Statement

I have uploaded the problem statement and corresponding programs.

Reader1 is another file that is suppose to help

## Homework Equations

I'm just having trouble getting started. I can do the analytical part on paper, but I don't know how to implement this in MATLAB.

In the program for problem 1:

What is the 'A' and 'C' matrix?

I can get some values on paper, but, for example, what is A(i, i+1)? I realize this this the temperature to the left of the node I am interested in, but do I type in some sort of equation?

Similarly for A(i,i), A(i, i-1), C(n)...

Is C(1) = -200 from my solution?

It seems I have to do what is says in the reader1 file, but I dont know how to use it

## The Attempt at a Solution

For #1a:

T(x) = C1x + C2
Boundary Conditions: T(0) = 500
T(L = 1m) = 300

Thus T(x) = 500 - 200x

q = -kA(dT/dx) = 37200 Watts, where k = 186 W/m.k

energy balance for internal nodes: q1 + q2 +qV = 0

q1 = kA[ (T_i-1) - T_i]
q2 = kA[(T_i+1) - T_i]
qV = dx = internal heat generation assuming dy=dz = infinite

Finite Diff. eqn: (T_i-1) - (2T_i) + (T_i+1) = 0

For the left boundary node:

q_left side = 0 b/c T = 500k is constant?

therefore q_right side + qV = 0

q_right side = kA[(T_i+1) - T_i] and qV is the same from before

Right Boundary Node:

q_left side = kA[(T_i-1) - T_i] and qV stays the same

How is this implemented in MATLAB?

For #1b:

Boundary Conditions: T(0) = 500
-kA(dT/dx) @ x=1m = hA(Ts -T_inf) [Convective BC]

Assuming C1 is the same from part a (is this correct?): T_inf = 462.8 K