Problem 84 The pressure drop p Nm2 in a tube can be calculat

Problem 8.4 The pressure drop p (N/m2) in a tube can be calculated with the following equation: where u is the dynamic viscosity (0.005 N-s/m2) Q is the flow (10x105 m3/s) r is the radius (m) x is the length (m) The length x (m) and radius r (m) of a tube are provided below. r (m) 0.002 0.00135 0.00134 0.0016 0.00158 0.00142 0.002 (m) 0 0.02 0.04 0.05 0.06 0.07 0.1 Write a MATLAB script or function (your choice) to apply BOTH the rectangle rule and the trapezoid rule to calculate the pressure drop p in the tube from the data provided. Use the appropriate output mechanism to display an output message of your choice and the pressure drop calculated using BOTH the rectangle rule and the trapezoid rule in the diary file. HINT: Given that you have data measured at discrete time points, how many divisions can you use to calculate the integral? Solution: The pressure calculated with the rectangle rule is: -2.6159e 03 The pressure calculated with the trapezoid rule is: 2.6159e 03 Page 5

Solution

The MATLAB code for finding pressure by given two methods is shown below followed by results

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

x=[0 0.02 0.04 0.05 0.06 0.07 0.1];
r=[0.002 0.00135 0.00134 0.0016 0.00158 0.00142 0.002];
u=0.005;
Q=10^-5;
I=-8*u*Q./(pi*r.^4);

p=0 % implementing rectangular formula using for loop
for i=1:6
p= p+I(i)*(x(i+1)-x(i));
end
p1=0; % implementing trapezoidal formula using for loop
for i=1:6
p1= p1+(I(i)+I(i+1))*(x(i+1)-x(i))/2;
end

fprintf(\'\ the pressure calculated by rectangular rule is : %5.4f \ \',p);
fprintf(\'\ the pressure calculated by rectangular rule is : %5.4f \ \',p1);

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

The results are

the pressure calculated by rectangular rule is : -2658.7689

the pressure calculated by rectangular rule is : -2582.8563
>>

 Problem 8.4 The pressure drop p (N/m2) in a tube can be calculated with the following equation: where u is the dynamic viscosity (0.005 N-s/m2) Q is the flow (

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site