Closed jtoumey closed 9 years ago
I was missing the nuance. The discretized equation at the left boundary is the same formulation as the interior points, so it's included in the loop. The only difference is the left-most temperature is known (T_0
), which is represented as T(ii=1)
. The loop proceeds from ii = 2:n-1
, and stores results in f(ii-1)
. That way, the temperature array (length n
) and the f
array (length n-1
) line up properly
When creating the solution vector f, it looks like the code never calculates a value for f(1). Instead, it starts at
ii = 2
and loops to the right boundary.Maybe I am missing some nuance, but I think this means
f(1)
goes un-initialized and could cause problems.