THMMY's "Optimization Techniques" course assignments.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GivenEnv.m 683 B

21 tuntia sitten
12345678910111213141516171819202122
  1. % Given environment
  2. clear;
  3. % Setup the function under test
  4. syms x y;
  5. fexpr = x^5 * exp(-x^2 - y^2);
  6. title_fun = "$f(x,y) = x^5 \cdot e^{-x^2 - y^2}$";
  7. % Calculate the gradient and Hessian
  8. grad_fexpr = gradient(fexpr, [x, y]); % Gradient of f
  9. hessian_fexpr = hessian(fexpr, [x, y]); % Hessian of f
  10. % Convert symbolic expressions to MATLAB functions
  11. fun = matlabFunction(fexpr, 'Vars', [x, y]); % Function
  12. grad_fun = matlabFunction(grad_fexpr, 'Vars', [x, y]); % Gradient
  13. hessian_fun = matlabFunction(hessian_fexpr, 'Vars', [x, y]); % Hessian
  14. % Amijo globals
  15. global amijo_beta amijo_sigma
  16. %fixed step size globals
  17. global gamma_fixed_step