필터 지우기
필터 지우기

numerical root finding procedures

조회 수: 10 (최근 30일)
harley
harley 2013년 8월 19일
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
  댓글 수: 3
harley
harley 2013년 8월 19일
thanks for that, when i run i get in the command window;
Exiting fzero: aborting search for an interval containing a sign change because complex function value encountered during search. (Function value at -0.28 is -9.229-3.1086i.) Check function or try again with a different starting value.
code is
D = 0.1;
e = 0.0015e-3;
nu = 1.01e-6;
eoverD = e/D;
%
V = 2;
%
Re = V*D / nu;
%
if Re < 2300
f = 64 / Re;
else
darbyFormula = @(x) 1/sqrt(x)+2*log10(eoverD/3.7 + 2.51/Re/sqrt(x));
f = fzero(darbyFormula,1);
end
harley
harley 2013년 8월 19일
got it working, thanks

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
the cyclist 2013년 8월 19일
편집: the cyclist 2013년 8월 19일
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)

추가 답변 (1개)

Walter Roberson
Walter Roberson 2013년 8월 19일
If you do some algebraic manipulation, you get
x = 0.3340248829e22 / (-0.5020000000e11 * lambertw(.4586822894 * Re * exp(.1239681863 * eoverD * Re)) + 6223202955 * eoverD * Re)^2
with no searching (provided that eoverD already has a value)
lambertw is in the Symbolic Toolbox. If you do not have that, then see http://www.mathworks.com/matlabcentral/newsreader/view_thread/32527

카테고리

Help CenterFile Exchange에서 Variables에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by