# Question: consider the following twodimensional function a using an anonymous function...

###### Question details

Consider the following two-dimensional function:

(a) Using an anonymous function for 𝑐𝑐(𝑥𝑥,𝑦𝑦) and MATLAB’s mesh
function, create a 3D plot of the function from −10 ≤ x ≤ 10, and
-10 ≤ y ≤ 10.

Page 2 of 3

(b) Using an initial guess of [0 0], find the maximum using
MATLAB’s built-in function fminsearch. Use the fprintf function to
print the results with 10 digits to the right of the decimal point
(e.g. “The maximum value of c, x.xxxxxxxxxx, occurs at x =
x.xxxxxxxxxx and y = x.xxxxxxxxxx.”)

(c) Using MATLAB’s plot3 and hold commands, plot a red asterisk at
the maximum in figure 2.

(d) Repeat parts b and c with an initial guess of [7 -5]. Use
fprintf statements to answer the question: What changes and
why?