error message contain ::: Error using colebrook (line 2) Not enough input arguments. how i can solve it please?
3 views (last 30 days)
Show older comments
Moath Maqableh
on 29 Apr 2017
Commented: Walter Roberson
on 29 Apr 2017

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
1 Comment
Walter Roberson
on 29 Apr 2017
You need to pass arguments when you call the function, just like you do inside the for loop.
Accepted Answer
Walter Roberson
on 29 Apr 2017
Edited: Walter Roberson
on 29 Apr 2017
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 Comments
Walter Roberson
on 29 Apr 2017
Wait... you have defined F in terms of F ? Is the idea to find the F such that the two sides balance?
Walter Roberson
on 29 Apr 2017
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
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!