colebrook iterative equation in a for loop
显示 更早的评论
DoM = [0.7620 0.8128 0.8636 0.9144 0.9652 1.0160 1.0668 1.1176 1.1684 1.2192]
Re= [319130 299180 281590 265940 251940 239350 227950 217590 208130 199460]
Ks=0.000045
Er=10.^-8
Fo=0.01;
for I=0:1:10^8;
Fn=(1./(-4.*log10(Ks./(3.71.*DoM))+(1.26./(Re.*sqrt(Fo))))).^2
E=abs((Fn-Fo)/Fn)
if E<=Er
Fn=Fn ;break;
elseif E>Er
Fn=Fo;
end
end
i have an iterative equation where i have to set an initial value for Fo=0.01 to ahieve the Left hand side (Fn)
then calculate the absolute error (E)
after that compare the absolute error (E) with the specified Erorr (Er)
if the absolute error (E) is greater than the specified Error (Er)
replace Fo with the new Fn achived earlier
and calculate for a new Fn
until the absolute error is less than the specified error (Er)
then show the final value of Fn
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!