MATLAB: Numerical root finding procedures

elseif

trying to solve the part under else. eover and Re are known, but still leaves me with (f) on both side of the original colebrook equation. 1/sqrt(f) = -2*log10(eoverD/3.7 + 2.51/Re/sqrt(f)). Please help, a bit stuck.
Re = V*D1 / nu;
% Check for laminar flow.
if Re < 2300
F = 64 / Re;
else
F(f)=1/sqrt(f)+2*log10(eoverD/3.7 + 2.51/Re/sqrt(f));
end

Best Answer

You should be able to use the function fzero() to solve for f in your implicit equation.
>> doc fzero
for details.
I think this will do it, but definitely check:
darbyFormula = @(x) 1/sqrt(x)+2*log10(eoverD/3.7 + 2.51/Re/sqrt(x));
f = fzero(darbyFormula,1)