THMMY's "Optimization Techniques" course assignments.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

22 rindas
683 B

  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