Question: Suppose you have an objective function to minimize: 2 4 2 f x y x y x ( , ) 3 . 5 2 =

Suppose you have an objective function to minimize:
242 f x y x y x (,)3.52=++ x xy y 2
1) Create a contour plot of the objective function over the domain of 2x 2
and
2y 2
and print it out. This can be conveniently done using the following code:
xVec = linspace(-2,2,101)';
yVec = linspace(-2,2,101)';
[x,y]= meshgrid(xVec,yVec);
f =-3.5*x -2*y - x.^2+ x.^4-2*x.*y + y.^2;
figure(1)
clf
contour(x,y,f,42)
grid
If you are unsure what some of those MATLAB commands do, please consult the
MATLAB documentation file (i.e. type doc into the Command Window and press Enter)
or ask your instructor.
2) By hand, perform two steps of a steepest descent algorithm using a step size of 2 starting
from an initial guess of (-2,-1). By hand, draw the corresponding steps as vectors on the
contour plot from Part 1 to demonstrate how the algorithm is approaching the minimum.
3) Solve for the unconstrained minimum of the objective function using fminunc. Have
your code print the minimum location to the Command Window as:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!