I can't exit from loop
Afficher commentaires plus anciens
I want to stop loop when Ur is equal to Uo,but it doesn't stop. For example when i put 0.015 for D, Ur is equal to Uo at Uo=544. It doesn't stop at 544 still countinues until it reach 600. And shows Ur for Uo=600. What is wrong with this code? Thank you.
function heatt= heatt(D)
for Uo=20:600
mc=10;
dc=866;
dh=950;
uc=0.097;
uh=0.2700*10^-3;
hfg=2.26*10^6;
Tci=50;
Tco=60;
cpc=2.03*10^3;
L=1.72;
Nprc=795;
Nprh=1.5;
q=mc*cpc*(Tco-Tci);
Thi=100;
Tho=100;
kc=0.014;
kh=0.6818;
hdi=5555;
hdo=1500;
Tlm=Thi-(Tco+Tci)/2;
mh=q/hfg
Ao=q/(Uo*Tlm);
n=Ao/(3.14*D*L)
vc=mc/(dc*3.14*D^2/4*n);
Nrec=vc*dc*D/uc;
if Nrec>2100
hi=n*kc*0.027*Nrec^0.8*Nprc^(1/3)/D;
else
hi=n*kc*1.86*(Nrec*Nprc*D/L)^(1/3)/D;
end
ho=0.725*(dh*dh*9.81*hfg*D^3/(n*uh*kh*45))^(1/4)*kh/D;
Ur=1/(1/ho+1/hi+1/hdo+1/hdi)
if Ur==Uo
break
end
end
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!