Iteration loop for a function to reach a certain value.
3 views (last 30 days)
Show older comments
Hello, I want to write an iteration loop for a function that needs an innitial guess. The equations work off of each other and thus a first guess is needed to find an answer, the method is as follows: Tc is the first guess, then 3 seperate values are found using the initial guess of Tc, and finally a new Tc is found utilizing the previous 3 values found. The final Tc value must be close to the initial guess for the answer to be correct and that is why I want the iteration loop to occur. Thank you in advance!
%the "+273.15" serves to convert celcius to kelvin
g=9.81;
NU=2.52;
k=.0293;%from book
L=.025;%plate to cover spacing m
sigma=5.6697e-8;
epsilonp=0.95;%plate emittance
epsilonc=0.88;%glass emittance
Ts=10+273.15;%ambient sky temp K
Tp=60+273.15;%mean plate temp K
Tc=35+273.156;%assumed collector temp K, this is the desired iterated value
hcpc=NU*(k/L);%conv. heat trans coeff
hw=10;
hrpc=((sigma*(Tp^2+Tc^2)*(Tp+Tc))/((1/epsilonp)+(1/epsilonc)-1));%rad conv
%between plate and collector
hrca=epsilonc*sigma*(Tc^2+Ts^2)*(Tc+Ts);%rad. coeff for cover to air
Ut=((1/(hcpc+hrpc))+(1/(hw+hrpc)))^-1;%top loss coeff from collector to ambient
Tc=Tp-((Ut*(Tp-Ts)/(hcpc+hrpc)));%this value must get close to value of original guess
0 Comments
Accepted Answer
Torsten
on 9 Mar 2024
g=9.81;
NU=2.52;
k=.0293;%from book
L=.025;%plate to cover spacing m
sigma=5.6697e-8;
epsilonp=0.95;%plate emittance
epsilonc=0.88;%glass emittance
Ts=10+273.15;%ambient sky temp K
Tp=60+273.15;%mean plate temp K
Tc=35+273.156;%assumed collector temp K, this is the desired iterated value
Tcnew = Inf;
hcpc=NU*(k/L);%conv. heat trans coeff
hw=10;
tol = 1e-6;
format long
while abs(Tc-Tcnew) > tol
Tcnew = Tc;
hrpc=((sigma*(Tp^2+Tc^2)*(Tp+Tc))/((1/epsilonp)+(1/epsilonc)-1));%rad conv
%between plate and collector
hrca=epsilonc*sigma*(Tc^2+Ts^2)*(Tc+Ts);%rad. coeff for cover to air
Ut=((1/(hcpc+hrpc))+(1/(hw+hrpc)))^-1;%top loss coeff from collector to ambient
Tc=Tp-((Ut*(Tp-Ts)/(hcpc+hrpc)));%this value must get close to value of original guess
Tc
end
More Answers (0)
See Also
Categories
Find more on General Physics 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!