Result diverging from explicit finite difference method
Mostra commenti meno recenti
Trying to solve a heat transfer problem by using matlab to simulate following equations and solving for temperature T(i+1)









Like i said, im solving every equation for T(x+1) and following code is what i come up with:
the criteria for it to NOT diverge is i=225 steps or more. Is it something in the code thats wrong that im missing? Any of the temperature shouldnt finish above 45 deg but right now i get the answe like 1.5*10^72.
function [T_1,T_2,T_3,T_4,T_5,T_6,T_7,T_8,T_9] = cengel5112
T_1(1)=-3;
T_2(1)=-3;
T_3(1)=-3;
T_4(1)=-3;
T_5(1)=-3;
T_6(1)=-3;
T_7(1)=-3;
T_8(1)=-3;
T_9(1)=-3;
for i=1:1:226
T_1(i+1)=((-21.42-7.14*T_1(i)+(0.1*(T_4(i)-T_1(i)))+(2.5*(T_2(i)-T_1(i))))/3.205)+T_1(i);
T_2(i+1)=(((2.5*(T_1(i)-T_2(i)))+(2.5*(T_3(i)-T_2(i)))+(0.2*(T_5(i)-T_2(i))))/6.41)+T_2(i);
T_3(i+1)=((-0.357-0.12*T_3(i)+0.1*(T_6(i)-T_3(i))+2.5*(T_2(i)-T_3(i)))/3.205)+T_3(i);
T_4(i+1)=((-0.21-0.07*T_4(i)+0.1*(T_1(i)-T_4(i))+0.1*(T_7(i)-T_4(i))+5*(T_5(i)-T_4(i)))/6.41)+T_4(i);
T_5(i+1)=((5*(T_4(i)-T_5(i))+5*(T_6(i)-T_5(i))+0.2*(T_8(i)-T_5(i))+0.2*(T_2(i)-T_5(i)))/12.82)+T_5(i);
T_6(i+1)=((-0.71-0.238*T_6(i)+0.1*(T_3(i)-T_6(i))+0.1*(T_9(i)-T_6(i))+5*(T_5(i)-T_6(i)))/6.41)+T_6(i);
T_7(i+1)=((14.773-0.0357*T_7(i)+0.1*(T_4(i)-T_7(i))+0.1*(T_8(i)-T_7(i))+5*(T_5(i)-T_6(i)))/3.205)+T_7(i);
T_8(i+1)=((2.5*(T_7(i)-T_8(i))+2.5*(T_9(i)-T_8(i))+0.2*(T_5(i)-T_8(i)))/6.41)+T_8(i);
T_9(i+1)=((-0.357-0.119*T_9(i)+0.1*(T_6(i)-T_9(i))+2.5*(T_8(i)-T_9(i)))/3.205)+T_9(i);
%t_1=T_1(i+1);
%t_7=T_7(i+1);
%plot(4*i,t_1,'o'); hold on
%plot(4*i,t_7,'o'); hold on
end
4 Commenti
John D'Errico
il 9 Feb 2019
Please don't add answers just ot make a comment.





This is the complete information. I cant see where it is going wrong!
andré nilsson
il 9 Feb 2019
John D'Errico
il 9 Feb 2019
And I moved it into a comment. You did not answer your question. You merely added information to your question.
Risposte (0)
Categorie
Scopri di più su Mathematics in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!