%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); endendI 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);
Best Answer