First compare the order of the input arguments in
F = @(f,Re) 2*log10(Re*sqrt(f))-0.8-(1/sqrt(f));
and in
fCW(k) = fzero( @(f) F( Re(k), f ), 0.05 );
then replace
fCW(k) = fzero( @(f) F( Re(k), f ), 0.05 );
by
fCW(k) = fzero( @(f) F( f, Re(k) ), 0.05 );
and the loop will return a vector of numbers
>> fCW = cssm()
fCW =
0.0309 0.0104 0.0093 0.0087 0.0084 0.0081
where
function fCW = cssm()
F = @(f,Re) 2*log10(Re*sqrt(f))-0.8-(1/sqrt(f));
Re = linspace(1e4,1e7,6);
fCW = zeros(size(Re));
for k = 1:length(Re)
fCW(k) = fzero( @(f) F(f,Re(k)), 0.05 );
end
end
 
In response to comment
[fCW,fB,fSJ,Re] = cssm()
figure, semilogy( fCW, Re, 'd' )
where
function [fCW,fB,fSJ,Re] = cssm()
F = @(f,Re) 2*log10(Re*sqrt(f))-0.8-(1/sqrt(f));
Re = logspace( 4,7,31 );
fCW = zeros(size(Re));
fB = zeros(size(Re));
fSJ = zeros(size(Re));
for k = 1:length(Re)
fCW(k) = fzero( @(f) F(f,Re(k)), 0.05);
fB(k) = 0.3164/Re(k)^0.25;
fSJ(k) = 0.25/(log(5.74/Re(k)^0.9))^2;
end
end