chbe2120fall2010hw7

chbe2120fall2010hw7 - ChBE 2120 Homework 7 Due: October 15,...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
ChBE 2120 Homework 7 Due: October 15, 2010 at 11:00 PM 1) For the following function: ݂ሺݔሻൌݔlnݔ൅2ݔ ݁ ି௫ ݃ሺݔ,ݕሻൌെ4ݔ ൅2ݔݕെݕ a) Write a Matlab function that represents the function above. Name your function hw7funcF_myGtAccountId.m . The function declaration may look like: function f = hw7funcF_mstyczynski6(x) b) Plot the function for 0.01 x 2. (You can do this in a separate script, or in the script from part D below.) Save the figure as a png file, hw7part1plot_myGtAccountId.png c) Write a function that uses the golden section search to find the value of x that maximizes an arbitrary function. (This is the method we have gone over in class.) Name your function goldenSectionMax_myGtAccountId.m . This function should take as input a function handle for your function to be optimized, the lower bound of the interval containing a maximum, and the upper bound of the interval containing a maximum. For example, the declaration may look like: function maxVal = goldenSectionMax_mstyczynski6(optFunc,x_l,x_u) Implement your function exactly as we described in class: compare the values of f(x 2 ) and f(x 1 ), and eliminate a portion of your interval as appropriate. Continue until the width of your interval is no greater than 10 -6 , and return the midpoint of the interval as your estimate of the x that maximizes the function. Hint: is the value of d the same at every step, or does it change with every step? How is d defined? d) Now make a Matlab script called hw7part1_myGtAccountId.m that calls your goldenSection command in order to minimize your funcF function. In order to do this, you will need to submit an additional file, that you should name
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

chbe2120fall2010hw7 - ChBE 2120 Homework 7 Due: October 15,...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online