Iterate simultaneous equations till it reach convergence
Show older comments
Question: How to iterate T_R, T_f and T_a for multiple times till T_f reaches convergence.
Code below:
Q_R=935.9432834;
h_f=2500;
A_f=0.017671459;
A_a=0.017671459;
h_cs=13.3;
L_c=0.15;
h_rs=8.8;
R_c=0.075;
T_amb=35;
E_bm=0.05;
SIGMA=5.67E-08;
T_sky=29;
h_a=10;
h_c=10;
h_ct=10;
m_f=2;
c_f=4186;
A_s=0.070685835;
A_top=0.017671459;
hct=8.8;
t_lid=0.01;
k_lid=237;
m_a=0.000797131;
c_a=718;
DELTAt=1;
m_R=0.5;
c_R=910;
T_R0=25; %initial condition"
T_f0=25; %initial condition"
T_a0=25; %initial condition"
T_R=(Q_R-(h_f*A_f)*(T_R0-T_f0)-((h_cs*2*L_c)+(h_rs*R_c))*3.14*R_c*(T_R0-T_amb)-(2*L_c+R_c)*(3.14*R_c*E_bm*SIGMA*(T_R0^4-T_sky^4))/(T_R0-T_amb))*(DELTAt)/(m_R*c_R)+T_R0;
T_f=(((h_f*A_f*(T_R0-T_f0))-(h_c*A_a*(T_f0-T_a0)))*DELTAt/(m_f*c_f))+T_f0;
T_a=(((h_a*A_a)*(T_f0-T_a0))+((h_a*A_s)*(T_R0-T_a0))-(A_top*(T_a0-T_amb))/(1/(h_ct+((E_bm*SIGMA*(T_R0^4-T_sky^4))/(T_a0-T_amb)))+(t_lid/k_lid)))*(DELTAt)/(m_a*c_a)+T_a0;
Expected Output Required:

Here the output is generated for 20 time steps. But we need to iterate till the difference between T_f upto 0.01 or 0.02.
1 Comment
KSSV
on 17 May 2019
Where is iteration in the code?
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!