Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2-D Optimization Your task is to write a Matlab function function [x,y,fval] fmin2d(f,vo,tol) (or fmin2d(f,xo,yo,tol)) that finds an approximate local minimum to an arbitrary function
2-D Optimization Your task is to write a Matlab function function [x,y,fval] fmin2d(f,vo,tol) (or fmin2d(f,xo,yo,tol)) that finds an approximate local minimum to an arbitrary function /(z y) starting from the point to = (ro,yo), returning the solution (z, y) and function value f(x,y). The function will use a strategy of alternating minimization, and should work as follows 1. The user should input some starting vector (Fo, ) If none is given, the program defaults to (xo, o) (0,0). 2. For k = 1,2, , use Matlab's built-in fminsearch to solve the l-D optimization problems (b) k arg min(). This means that if the solution to the problem is (x.,y.), then yo, Vi, V2 . are approx- imate solutions for y, hopefully converging to s, as the number of iterations increases. Similarly, 10,1,22, . . . are solutions for, converging to.. The notation arg min, f(x, yk-1) means that y-1 is a fixed constant (the solution from the previous iteration) and zu is the value of z for which f(z, Vk-1) has the smallest value (this valuc would then be f(1). 3. Repeat the previous step until small enough progress is made: f(n,yj-f(n+1,3%+1) 0,y > 0 (although you can get arbitrarily close to zero along the line z y). For example, with the functions definod above the code may run as follows >> [x,y,fval] fmin2d(g, [1,3]) (returns x = 5.9479, y 5.9511, fval 0.0842 after 245 iterations) >> [x,y,fval] = fmin2d(f) (returns x-2.3320, y -2.6660, f =-5.3333 after 6 iterations) >> [x,y,fval] fain2d(1, [1,7], .08) (returns x =-2.2578, y-2.6289, f --5.2649 after 4 iterations)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started