Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Where: Re Reynolds number; Re = 5150 V D V flow velocity D pipe diameter Write a

ID: 2998366 • Letter: W

Question

Where:

Re           Reynolds number; Re = 5150 V D

V             flow velocity

D             pipe diameter

Write a MATLAB program that calculates the friction factor for the following conditions:

        Velocity (ft/sec):          1.6          2.0          7.5          5.4          8.5          10.0      20.0

        Pipe diameter (ft):       0.1          0.2          0.5          0.8          1.0          4.0          5.0

Store the data in a text file pipe.txt. (Only values are stored in the file). The program does the following:

Reads the data from the file and store them in two arrays.

Calculates the Reynolds number.

Calculates the friction factor f .

Prints an output in tabular form; sample output with fictitious values is shown as an example.

Your name

Problem 2

Diameter    Velocity    Reynlods no       Friction F

0.10        1.6         8.2400e+02        0.0777

x.xx        x.x         x.xxxxe+xx        x.xxxx

Where: Re Reynolds number; Re =5150 V D V flow velocity D pipe diameter Write a MATLAB program that calculates the friction factor for the following conditions: Velocity (ft/sec): 1.6 2.0 7.5 5.4 8.5 10.0 20.0 Pipe diameter (ft): 0.1 0.2 0.5 0.8 1.0 4.0 5.0 Store the data in a text file ½pipe.txt½. (Only values are stored in the file). The program does the following: Reads the data from the file and store them in two arrays. Calculates the Reynolds number. Calculates the friction factor f . Prints an output in tabular form; sample output with fictitious values is shown as an example. Your name Problem 2 Diameter Velocity Reynlods no Friction F 0.10 1.6 8.2400e+02 0.0777 x.xx x.x x.xxxxe+xx x.xxxx The friction factor f is a parameter used to study fluid flow in pipes. It is given by:

Explanation / Answer

Code:

fif = fopen('pipe.txt');
V = fscanf(fif,'%g',7);
Dia = fscanf(fif,'%g');
fclose(fif);
Re = 5150*V.*Dia;
disp('Diameter    Velocity    Reynolds Number    friction factor');
for i=1:7
if Re(i)<2300
    f(i) = 64/Re(i);
elseif Re(i)>2300&&Re(i)<10000
    f(i) = 0.316/(Re(i)^0.25);
else
    f(i) = 0.25*[log10(5.74/Re(i)^0.9)]^-2;
end
fprintf('%f     %f      %f      %f ',Dia(i),V(i),Re(i),f(i));
end


Output:

Diameter    Velocity    Reynolds Number    friction factor
0.100000     1.600000      824.000000      0.077670
0.200000     2.000000      2060.000000      0.031068
0.500000     7.500000      19312.500000      0.026042
0.800000     5.400000      22248.000000      0.025137
1.000000     8.500000      43775.000000      0.021397
4.000000     10.000000      206000.000000      0.015442
5.000000     20.000000      515000.000000      0.013021

Create a file pipe.txt and copy the following data into it 1.6 2.0 7.5 5.4 8.5 10.0 20.0 0.1 0.2 0.5 0.8 1.0 4.0 5.0.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote