|
- function [] = interval_over_iterations(method)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- GivenEnv;
-
- fig_dir = 'figures';
- if ~exist(fig_dir, 'dir')
- mkdir(fig_dir);
- end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- N = 3;
- 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);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- disp(" ");
- for i = 1:length(funs)
- figure('Name', "interval_over_iterations_" + char(method) + "_fun" + i, 'NumberTitle', 'off');
- set(gcf, 'Position', [100, 100, 1280, 720]);
- for j = 1:N
- [a, b, k(j), n(j)] = method(funs(i), a_0, b_0, epsilon, lambda(j));
-
- fprintf('%20s(%34s ): [a, b]= [%f, %f], @lambda=%f, iterations= %d\n', ...
- char(method), char(funs(i)), a(end), b(end), lambda(j), k(j) );
-
- subplot(length(funs), 1, j);
- plot(1:length(a), a, 'ob');
- hold on
- plot(1:length(b), b, '*r');
- if j == 1
- title(titles(i), 'Interpreter', 'latex', 'FontSize', 16);
- end
- xlabel("Iterations @lambda=" + lambda(j));
- ylabel('[a_k, b_k]');
- end
-
-
-
- fig_png = fullfile(fig_dir, "interval_over_iterations_" + char(method) + "_fun" + i + ".png");
-
-
- print(gcf, fig_png, '-dpng', '-r300');
-
- close(gcf);
- end
|