Matlab unrecognized function or variable

조회 수: 5 (최근 30일)
Fatih Güler
Fatih Güler 2020년 12월 13일
댓글: Walter Roberson 2020년 12월 13일
p=1.23;
D=.005;
V=40;
mu=1.7910^-5;
e=.0015;
Re=pVD/mu;%reynolds number equation
f=@(x)(1/sqrt(x)+2log(e/(3.7D)+2.51/(Resqrt(x))));
a=.008;
b=.08;
while abs(b-a)>1e-9
c=(a+b)/2;
if f(a)*f(c)<0
b=c;
else
a=c;
end
end
fprintf('Root found: %.10f\n',c)
fprintf('Function value at root %E\n',f(c))
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 12월 13일
Fatih Güler: your question does not contain any advertisement, so it is not spam.

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

채택된 답변

Ive J
Ive J 2020년 12월 13일
Correct these two lines
Re=p*V*D/mu;%reynolds number equation
f=@(x)(1/sqrt(x)+2*log(e/(3.7*D)+2.51/(Re*sqrt(x))));

추가 답변 (1개)

Walter Roberson
Walter Roberson 2020년 12월 13일
MATLAB has absolutely no implied multiplication. If you want p multiplied by V multiplied by D then you need p*V*D not pVD .
... otherwise if you had an m and a u variable, how would it know whether that division by mu was division by the variable mu or division by (m * u) or division by m and then multiplication by u ?

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by