error message contain ::: Error using colebrook (line 2) Not enough input arguments. how i can solve it please?

3 次查看(过去 30 天)
function F = colebrook(Re,K)
F= (1/(-2*log10((K/3.7)+(2.51/Re*sqrt(F)))))^2;
for i=1:20
Re=i*10^3;
K=0.00002;
colebrook(Re,K)
end
end

采纳的回答

Walter Roberson
Walter Roberson 2017-4-29
编辑:Walter Roberson 2017-4-29
colebrook = @(Re,K) (1/(-2*log10((K/3.7)+(2.51/Re*sqrt(F)))))^2;
cb = zeros(1,20);
for i=1:20
Re=i*10^3;
K=0.00002;
cb(i) = colebrook(Re,K);
end
cb
  3 个评论
Walter Roberson
Walter Roberson 2017-4-29
Presuming that the idea is to find the F that balances the equation:
colebrook = @(Re,K) (1/(-2*log10((K/3.7)+(2.51/Re*sqrt(F)))))^2;
cf = @(Re,K,F) (1/(-2*log10((K/3.7)+(2.51/Re*sqrt(F)))))^2 - F;
cb = zeros(1,20);
for i=1:20
Re=i*10^3;
K=0.00002;
cb(i) = fzero(@(F) cf(Re,K,F), [0 1]);
end
cb
cb =
Columns 1 through 6
0.0212456669959142 0.0176438993118644 0.0159918090443276 0.0149809406929249 0.0142775420985982 0.0137506154874361
Columns 7 through 12
0.0133364599564298 0.0129997383391223 0.0127190013698845 0.0124803457077015 0.0122742958406683 0.0120941332432202
Columns 13 through 18
0.0119349390546334 0.0117930153254043 0.0116655193666966 0.0115502240640389 0.0114453557666283 0.01134948165294
Columns 19 through 20
0.0112614296189815 0.0111802301156452

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by