Why is my iteration not working. ? ( the solution array has all the same value from first iteration )
显示 更早的评论
%function F = Gaddis(x)
for (i = 1:40)
vol(1) = 5*10^(-6); % volumetric gas flow rate
sig = 0.0728;
do = 6*(10^(-3));
den = 998;
g = 9.81;
mu = 8.9*10^(-4);
s = (6*do*sig/(den*g));
L = (81*mu*vol(i)/(pi*g*den));
T = (135*(vol(i)^2)/(4*(pi^2)*g));
F = (x^3) - s - (L/x) - (T/(x^2));
vol(i+1) = vol(i) + 10^(-6);
end
end
I used fsolve solver to solve this function . '
As my volume changes , i am supposed to get new values of diametre , but it shows the same value for all the 40 iterations.
command code xsol(i) = fsolve(@(x) Gaddis(x), 0.0001);
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Structural Mechanics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!