|
|
@@ -6,20 +6,20 @@ |
|
|
|
|
|
|
|
% Clear workspace and load the functions and region |
|
|
|
clear |
|
|
|
|
|
|
|
funGivenEnv; |
|
|
|
addpath('..'); |
|
|
|
GivenEnv; |
|
|
|
|
|
|
|
% * 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 |
|
|
|
% * N: 50 points |
|
|
|
|
|
|
|
size = 25; |
|
|
|
N = 50; |
|
|
|
lambda = 0.01; |
|
|
|
de = 0.0001; |
|
|
|
epsilon = linspace(de, (lambda/2)-de, size); |
|
|
|
k = zeros(1,size); |
|
|
|
epsilon = linspace(de, (lambda/2)-de, N); |
|
|
|
k = zeros(1,N); % preallocate k |
|
|
|
|
|
|
|
|
|
|
|
% |
|
|
@@ -27,15 +27,11 @@ k = zeros(1,size); |
|
|
|
% keep the number of iterations needed. |
|
|
|
% * Plot the iterations k(epsilon) 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); |
|
|
|
for i = 1:size(funs,2) |
|
|
|
for j = 1:N |
|
|
|
[a, b, k(j)] = bisection(funs{i}, a_0, b_0, epsilon(j), lambda); |
|
|
|
end |
|
|
|
subplot(1, 3, i) |
|
|
|
subplot(1, length(funs), i) |
|
|
|
plot(epsilon, k, '-b', 'LineWidth', 1.0) |
|
|
|
title(titles(i), 'Interpreter', 'latex') |
|
|
|
xlabel('epsilon') |