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 772 B

3 days ago
12345678910111213141516171819202122232425262728
  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
  18. global image_width,
  19. global image_height;
  20. image_width = 960;
  21. image_height = 640;