Why is my iteration not working. ? ( the solution array has all the same value from first iteration )
Show older comments
%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);
Accepted Answer
More Answers (0)
Categories
Find more on Structural Mechanics 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!