# CPC 2011 Final Essay

Submitted By katheeka
Words: 988
Pages: 4

The University of Western Ontario Faculty of Engineering

Department of Chemical and Biochemical Engineering CBE 2291 Computational Methods

Final Examination – April 25, 2011 HSB 13/14/16

Time: 2:00 p.m. – 5:00 p.m.

All paper documents (books, lecture notes) allowed

Access to the web, other than course material and WebCT, is forbidden.

University policy states that cheating on an examination is a scholastic offense. The commission of a scholastic offense is attended by academic penalties which might include expulsion from program. If you are caught cheating, there will be no second warning.

Name___________________________________
Student # _______________________________

1. Matlab fundamentals (5 marks) a) Use linspace to create vectors identical to the following created with the colon notation:

t=5:6:30 x=-­‐3:4 b) Use the colon notations to create vectors identical to the following created with linspace:

a=linspace(-­‐3,1,9) r=linspace(8,0,17) c) If a force F (N) is applied to compress a spring, its displacement x (m) can often be modeled by Hook’s law: F = kx where k is the spring constant (N/m). The potential energy stored in the spring U (J) can be calculated as: 1
U = kx 2 2
Five
springs are tested and the following data compiled: F, N 11

12

15

9

12 X, m 0.013

0.020

0.009

0.010

0.012 €
Use
Matlab to store F and x as vectors and then compute vectors of the spring constant and the potential energies. Use the max function to determine the maximum potential energy.

2. Fluid (5 marks) For fluid flow in pipes, friction is described by a dimensionless number, the Fanning friction factor f. The friction factor is dependent of on a number of parameters related to the size of the pipe and the fluid, which can all be represented by another dimensionless quantity, the Reynolds number Re. The von Karman equation predicts f for given Re’s. 1
= 4 log10 Re f − 0.4

f
Typical
values for Re for turbulent flow are 10,000 to 500,000 and for f are 0.001 to 0.01.

Develop a function that uses bisection to solve for f given a user