|
- function [] = iterations_over_lambda(method)
-
-
-
-
-
-
-
-
-
-
-
-
-
- GivenEnv;
-
- fig_dir = 'figures';
- if ~exist(fig_dir, 'dir')
- mkdir(fig_dir);
- end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- N = 50;
- epsilon = 0.001;
- lambda_min = 0.0021;
- lambda_max = 0.1;
- lambda = linspace(lambda_min, lambda_max, N);
- k = zeros(1, N);
- n = zeros(1, N);
-
-
-
-
-
-
-
-
-
-
-
-
-
- figure('Name', "iterations_over_lambda_" + char(method), 'NumberTitle', 'off');
- set(gcf, 'Position', [100, 100, 1280, 600]);
-
- disp(" ");
- for i = 1:length(funs)
- for j = N:-1:1
- [a, b, k(j), n(j)] = method(funs(i), a_0, b_0, epsilon, lambda(j));
- end
-
- fprintf('%20s(%34s ): [a, b]= [%f, %f], iters(min, max)= (%d, %d), calls(min, max)= (%d, %d)\n', ...
- char(method), char(funs(i)), a(end), b(end), k(N), k(1), n(N), n(1) );
- subplot(1, length(funs), i);
- plot(lambda, n, '-b', 'LineWidth', 1.0);
- title(titles(i), 'Interpreter', 'latex', 'FontSize', 16);
- xlabel('lambda');
- ylabel("Calls of f" + i);
- end
-
-
-
-
-
-
- fig_png = fullfile(fig_dir, "iter_over_lambda_" + char(method) + ".png");
-
-
- print(gcf, fig_png, '-dpng', '-r300');
-
- close(gcf);
-
-
|