Переглянути джерело

Add fixed epsilon and lambda variations for bisection method

tags/v1.0
Christos Choutouridis 3 тижднів тому
джерело
коміт
59c61e5824
2 змінених файлів з 50 додано та 3 видалено
  1. +47
    -0
      Work 1/scripts/bisection_epsilonFixed.m
  2. +3
    -3
      Work 1/scripts/bisection_lambdaFixed.m

+ 47
- 0
Work 1/scripts/bisection_epsilonFixed.m Переглянути файл

@@ -0,0 +1,47 @@
%
% Keeping epsilon fixed, test the iteration needed for different lambda
% values.
%


% Clear workspace and load the functions and region
clear

funGivenEnv;

% * epsilon: e = 0.001
% * lambda: l > 2e = 0.001
% * dl: A small step away from 2e
% dl = 0.0001
% * lambda_max: 0.1
% * size: 25 points

size = 25;
epsilon = 0.001;
dl = 0.0001;
lambda_max= 0.1;
lambda = linspace(2*epsilon + dl, lambda_max, size);
k = zeros(1,size);


%
% * Call the bisection method for each lambda value for each function and
% keep the number of iterations needed.
% * Plot the iterations k(lambda) for each function
%
i = 0;
for f = funs
i = i + 1;
j = 0;
for l = lambda
j = j + 1;
[a, b, k(j)] = bisection(f, a_0, b_0, epsilon, l);
end
subplot(1, 3, i)
plot(lambda, k, '-b', 'LineWidth', 1.0)
title(titles(i), 'Interpreter', 'latex')
xlabel('lambda')
ylabel('Iterations')
end


Work 1/scripts/bisectionA_lamdaFixed.m → Work 1/scripts/bisection_lambdaFixed.m Переглянути файл

@@ -1,6 +1,6 @@
%
% Keeping l (accuracy) fix, test the iteration needed for different e
% values.
% Keeping l (accuracy) fixed, test the iteration needed for different
% epsilon values.
%


@@ -25,7 +25,7 @@ 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
% * Plot the iterations k(epsilon) for each function
%
i = 0;
for f = funs

Завантаження…
Відмінити
Зберегти