|
|
@@ -0,0 +1,45 @@ |
|
|
|
% |
|
|
|
% Keeping l (accuracy) fix, test the iteration needed for different e |
|
|
|
% values. |
|
|
|
% |
|
|
|
|
|
|
|
|
|
|
|
% Clear workspace and load the functions and region |
|
|
|
clear |
|
|
|
|
|
|
|
funGivenEnv; |
|
|
|
|
|
|
|
% * lambda = 0.01 |
|
|
|
% * epsilon: e < lambda/2 = 0.005 |
|
|
|
% * de: A small step away from zero and lambda/2 |
|
|
|
% de = 0.0001 |
|
|
|
% * size: 25 points |
|
|
|
|
|
|
|
size = 25; |
|
|
|
lambda = 0.01; |
|
|
|
de = 0.0001; |
|
|
|
epsilon = linspace(de, (lambda/2)-de, size); |
|
|
|
k = zeros(1,size); |
|
|
|
|
|
|
|
|
|
|
|
% |
|
|
|
% * Call the bisection method for each epsilon value for each function and |
|
|
|
% keep the number of iterations needed. |
|
|
|
% * Plot the (epsilon, iterations) for each function |
|
|
|
% |
|
|
|
i = 0; |
|
|
|
for f = funs |
|
|
|
i = i + 1; |
|
|
|
j = 0; |
|
|
|
for e = epsilon |
|
|
|
j = j + 1; |
|
|
|
[a, b, k(j)] = bisection(f, a_0, b_0, e, lambda); |
|
|
|
end |
|
|
|
subplot(1, 3, i) |
|
|
|
plot(epsilon, k, '-b', 'LineWidth', 1.0) |
|
|
|
title(titles(i), 'Interpreter', 'latex') |
|
|
|
xlabel('epsilon') |
|
|
|
ylabel('Iterations') |
|
|
|
end |
|
|
|
|
|
|
|
|