Test Cases Design Introduction Functions for Interacting wit

Test Cases Design Introduction Functions for Interacting with the User Functions for Calculations Functions for Plotting Functions for Files

Solution

For the given information follwing is the matlab code:

rho=input(\'input density\');
u=input(\'input dynamic viscosity\');
d=input(\'input dia of pipe\');
v=input(\'fluid velocity\');
Re=pho*v*d/u;
e=input(\'pipe roughness\');
%bisection method to find f (friction factor)
f1=0.0001;
f2=1;
g1=1/(f1)^0.5+2*log10((e/3.7/d)+2.51/Re/((f1)^0.5));
g2=1/(f2)^0.5+2*log10((e/3.7/d)+2.51/Re/((f2)^0.5));
err=abs(f1);
while(err<10e-6)
m=(f1+f2)/2;
gm=1/(m)^0.5+2*log10((e/3.7/d)+2.51/Re/((m)^0.5));
if(g1*gm<0)
f2=m;
else
f1=m;
end
g1=1/(f1)^0.5+2*log10((e/3.7/d)+2.51/Re/((f1)^0.5));
g2=1/(f2)^0.5+2*log10((e/3.7/d)+2.51/Re/((f2)^0.5));
err=(f1-f2);
end

 Test Cases Design Introduction Functions for Interacting with the User Functions for Calculations Functions for Plotting Functions for Files SolutionFor the gi

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site