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

MATLAB Question, please help! If the velocity distribution of a fluid flowing th

ID: 3664101 • Letter: M

Question

MATLAB Question, please help!

If the velocity distribution of a fluid flowing through a pipe is known, the flow rate Q can be computed using the formula: Q = integral vda where v is the velocity and A is the pipe's cross sectional area. For a circular pipe, A = pir^2 and dA = 2pir dr, therefore: Q = integral ^'_0 v(2pir)dr where r is the radial distance measured outward from the center of the pipe. If the velocity distribution is given by the following profile: v = 2 (1 - r/r_0)^1/6where r_0 is the radius of the pipe (3 cm in this case), compute Q using the trapz function in MATLAB.

Explanation / Answer

Solution: See the code below:

--------------------------------------------------

%This program calculates the flow rate Q of a fluid flowing through a pipe of radius r and velocity distribution v.

PI=3.1416; %value of constant PI

r0=3.0; %radius of pipe in cm

r=[0.0,3.0]; %range over which integral is to be performed.

n=1.0/6.0; %value of exponent in velocity distribution function

v=2.0*(1-r./r0).^n; %velocity distribution function of pipe

%calculation of Q using trapz method

Q=2.0*PI*trapz(r,v);

printf("Q:%.2f ",Q);

--------------------------------