1. Science
  2. Advanced Physics
  3. consider the following twodimensional function a using an anonymous function...

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

Question details

Consider the following two-dimensional function:

sin(V (z +3)2 + (y+ 2)2) V(x +3)2 + (y 2)2 S2n c(r, y) -
(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?

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution