syms t
soln = dsolve('D2T1/5 - 2*DT1 = 0', 'D2T2/5 - 2*DT2 + 5000 = 0',...
'D2T3/5 - 2*DT3 = 0', 'T1(0) = 20', 'T3(1) = 100');
eqs{1} = subs(soln.T1, t, .2) - subs(soln.T2, t, .2);
eqs{2} = subs(soln.T2, t, .4) - subs(soln.T3, t, .4);
eqs{3} = subs(diff(soln.T1,t), t, .2) - subs(diff(soln.T2,t), t, .2);
eqs{4} = subs(diff(soln.T2,t), t, .4) - subs(diff(soln.T3,t), t, .4);
constvals = solve(eqs{:});
constnames = fieldnames(constvals);
Soln.T1 = subs(soln.T1, constnames.', struct2cell(constvals).');
Soln.T2 = subs(soln.T2, constnames.', struct2cell(constvals).');
Soln.T3 = subs(soln.T3, constnames.', struct2cell(constvals).');
Best Answer