You are on page 1of 3

COLEBROOK:-

roughness = input('enter roughness >');


finitial = input('enter finitial');
l=0;
for h=1:1:5
roughness=roughness*2;
for p=3:1:7
c=finitial;
for k=1:1:10
l=l+1;
n(l)=10^p+((10^(p+1))-(10^(p)))*k/10;
s=colebrook(roughness,n(l),finitial);
F(l)=1/s^2;
end
end
semilogx(n(1:50),F(1:50)),xlabel('Reynolds Number'),ylabel('Friction
Factor'),title('Moody Chart'),hold on
end

function[a] = func(w,y,z)
a = z+2*log10((w/(3.7))+(2.51*z)/y);
end
function[a] = dfunc(w,y,z)
a = 1+(2*(2.51/y)*log10(2.711))/((w/(3.7))+(2.51*z)/y);
end
function[a]=colebrook(roughness,i,c)
for k=1:1:100
d=c-func(roughness,i,c)/dfunc(roughness,i,c);
if abs((d-c)/c)<.01
break;
end
c=d;
end
a=c;
end

OUTPUT:-
enter roughness >

.00004

enter finitial

.01

enter roughness >


.0001

enter finitial

.01

enter roughness >

.0005

enter finitial

.01

enter roughness >

.001

enter finitial

.01

enter roughness >

.005

enter finitial

.01

You might also like