4.2the if-else statement 55
Exercise 7: Decision making (continued)
- (continued) The friction factor,f, is calculated as:
f=
64
[Re whenRe^62000
−2.01·ln
[−5.0452
Re ln
(5.8506
Re0.8981
)]]− 2
whenRe > 2000
Write a function that calculates the energy loss per mass of flowing
fluid for a fluid flow in a pipe, given the pipe diameter, pipe length, fluid
volumetric flow rate, fluid density, and fluid viscosity (all in SI units). Test
your function with:D=0.2 m,L=10 m,Q=1 m^3 /s,ρ=1000 kg/m^3
andμ=0.001 kg/ms.
[Answer: 47.0948 J/kg ]
Exercise 7 Solutions
(http://www.eng.ed.ac.uk/teaching/courses/matlab/unit04/Ex7-
Solutions.shtml)
Additional Exercises
You should now attempt questions from Chapter C.4.
Advanced Topic
If you are interested, read about theswitchstatement in Appendix A.