I am writing a code that keep giving error message.
Afficher commentaires plus anciens
function f=DarcyFricFact(D,E,Re)
% Calculatre Friction factor
% f: is friction
% E :pipe roughness (for cast iron, 0.010")
% D: pipe diameter in inches
% Re: Reynolds number
% For loop will help use to write the program
%%%%%%Argument
D=[2 5 10];
Re=(4000:400000);
E=0.01;
f1=zeros(1,350000);
f2=zeros(1,350000);
f3=zeros(1,350000);
n=1
Num=length (Re);
k=1;
f=zeros(k,Num);
for n=1:Num;
a = 2/log(10)
b = (E./D)/3.7;
d=log(10)*Re(n)/5.02
s=b*d+log(d);
q=s.^(s/(s+1));
g=b*d+log(d./q);
z=log(q/g);
DLA=z*(g/(g+1));
DCFA=DLA.*(1+(z/2)/((g+10.^(2) + (z/3).*(2.*g-1))));
f(k)=(a*((log(d/q)+DCFA))).^(-2);
end
end
2 commentaires
per isakson
le 8 Juil 2016
Modifié(e) : per isakson
le 8 Juil 2016
There are many problems. Replacing
DCFA=DLA.*(1+(z/2)/((g+10.^(2) + (z/3).*(2.*g-1))));
by
DCFA=DLA.*(1+(z/2)./((g+10.^(2) + (z/3).*(2.*g-1))));
PaulBan
le 8 Juil 2016
Réponses (0)
Catégories
En savoir plus sur Power and Energy Systems dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!