Develop a single script to a generate contour and

PROBLEMS 201

7.22 The normal distribution is a bell-shaped curve defined by

y = e −x 2 Use the golden-section search to determine the location of the inflection point of this curve for positive x.

7.23 Use the

fminsearch function to determine the minimum of f x, y = 2y 2 − 2.25x y − 1.75y + 1.5x 2

7.24 Use the

fminsearch function to determine the maximum of f x, y = 4x + 2y + x 2 − 2x 4 + 2x y − 3y 2

7.25 Given the following function:

f x, y = −8x + x 2 + 12y + 4y 2 − 2x y Determine the minimum a graphically, b numerically with the fminsearch function, and c substitute the result of b back into the function to determine the minimum f x, y.

7.26 The specific growth rate of a yeast that produces an

antibiotic is a function of the food concentration c: g = 2c 4 + 0.8c + c 2 + 0.2c 3 As depicted in Fig. P7.26, growth goes to zero at very low concentrations due to food limitation. It also goes to zero at high concentrations due to toxicity effects. Find the value of c at which growth is a maximum.

7.27 A compound A will be converted into B in a stirred

tank reactor. The product B and unreacted A are purified in a separation unit. Unreacted A is recycled to the reactor. A process engineer has found that the initial cost of the system

7.16 Develop an M-file to locate a minimum with the

golden-section search. Rather than using the maximum itera- tions and Eq. 7.9 as the stopping criteria, determine the number of iterations needed to attain a desired tolerance. Test your function by solving Example 7.2 using E a ,d = 0.0001.

7.17 Develop an M-file to implement parabolic interpola-

tion to locate a minimum. The function should have the following features: • Base it on two initial guesses, and have the program generate the third initial value at the midpoint of the interval. • Check whether the guesses bracket a maximum. If not, the function should not implement the algorithm, but should return an error message. • Iterate until the relative error falls below a stopping cri- terion or exceeds a maximum number of iterations. • Return both the optimal x and f x. Test your program with the same problem as Example 7.3.

7.18 Pressure measurements are taken at certain points

behind an airfoil over time. These data best fit the curve y = 6 cos x − 1.5 sin x from x = 0 to 6 s. Use four iterations of the golden-search method to find the minimum pressure. Set x l = 2 and x u = 4.

7.19 The trajectory of a ball can be computed with

y = tan θ x − g 2v 2 cos 2 θ x 2 + y where y = the height m, θ = the initial angle radians, v = the initial velocity ms, g = the gravitational constant = 9.81 ms 2 , and y = the initial height m. Use the golden-section search to determine the maximum height given y = 1 m, v = 25 ms, and θ = 50 ◦ . Iterate until the approximate error falls below ε s = 1 using initial guesses of x l = 0 and x u = 60 m.

7.20 The deflection of a uniform beam subject to a linearly

increasing distributed load can be computed as y = w 120E I L −x 5 + 2L 2 x 3 − L 4 x Given that L = 600 cm, E = 50,000 kNcm 2 , I = 30,000 cm 4 , and w = 2.5 kNcm, determine the point of maximum de- flection a graphically, b using the golden-section search until the approximate error falls below ε s = 1 with initial guesses of x l = 0 and x u = L. 7.21 A object with a mass of 90 kg is projected upward from the surface of the earth at a velocity of 60 ms. If the object is subject to linear drag c = 15 kgs, use the golden- section search to determine the maximum height the object attains. 5 10 0.4 c mgL g d ⫺1 0.2 FIGURE P7.26 The specific growth rate of a yeast that produces an antibiotic versus the food concentration.