Question: Part2: Nonlinear optimization (50 points) -3y Exercise 1: consider the function f(x, y) = r? + y2 +1 The following MATLAB code plot the level
Part2: Nonlinear optimization (50 points) -3y Exercise 1: consider the function f(x, y) = r? + y2 +1 The following MATLAB code plot the level sets (contour) of the function 1(x, y] =meshgrid(-2:.1:2); 22=-3*y./(x.^2+y^2+1); 3 [c, h]=contour (x,y,z,-1.25: .25:1.25); 4 clabel (c, h); Line 1: defines the grid from -2 to 2 in step of 0.1 Line 2: defines the function Line 3: plot the contour for specific level sets (between-1.25 to 1.25 in step of 0.25) Line 4: show the value (label) of each contour a) Run the code in MATLAB and show the obtained figure. b) What is the maximum and what is the minimum of the function? How can you tell? Explain. Note that you might need to change the contour options to show more level sets. c) Remove line 4, use contour3 instead of contour (2 for 3D). See the maximum and minimum
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
