Info

This question is closed. Reopen it to edit or answer.

Code a MATLAB function that uses either steepest descent or Newton's method to find a local minimum of an arbitrary function, starting from a user-selected point

1 view (last 30 days)
•It should take four inputs, in the following order:
1.the function to minimize
2.a vector giving the starting point for the algorithm,
3.which of steepest descent or Newton's method to use, and
4.the maximum number of iterations to perform.
These inputs should be taken at the command line, and not using the input function. •Your code cannot use any built-in functions to compute gradients and hessians. Rather, you should use your own functions to numerically approximate these.
•Your code should conduct iterations on its own and report its progress as it does so (it does not have to report its progress after every single iteration).
•If the user selects Newton's method and your code is at a point at which Newton iterations may increase the objective function value, it should instead use steepest descent to determine the direction to guarantee objective function improvement (and indicate this to the user).
•Your code should select a step size that improves the objective function value, however you do not need to do an exact line search.
•Once your function terminates (either because it has found a stationary point or because it has run the maximum number of iterations) it should report the final solution and objective function value. C

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!