|
-
-
- clear;
-
- syms x [2 1] real;
- fexpr = (1/3)*x(1)^2 +3*x(2)^2;
- title_fun = "$f(x) = \frac{1}{3}{x_1}^2 + 3{x_2}^2$";
-
- XSetLimmits = [-10, 5 ; -8, 12];
-
-
- grad_fexpr = gradient(fexpr, x);
- hessian_fexpr = hessian(fexpr, x);
-
-
- fun = matlabFunction(fexpr, 'Vars', {x});
- grad_fun = matlabFunction(grad_fexpr, 'Vars', {x});
- hessian_fun = matlabFunction(hessian_fexpr, 'Vars', {x});
-
-
- [Xmin, Fmin] = fminsearch(fun, [-1, -1]');
- Xmin = round(Xmin, 3);
- Fmin = round(Fmin, 3);
-
-
- global amijo_beta;
- global amijo_sigma;
-
-
- global gamma_fixed_step
-
- global image_width,
- global image_height;
-
- image_width = 960;
- image_height = 640;
|