|
1234567891011121314151617181920212223242526272829303132333435363738394041 |
- %
- % Keeping lambda (accuracy) fixed, test the iteration needed for different
- % epsilon values.
- %
-
-
- % Clear workspace and load the functions and interval
- clear
- addpath('..');
- GivenEnv;
-
- % * lambda = 0.01
- % * epsilon: e < lambda/2 = 0.005
- % * de: A small step away from zero and lambda/2
- % de = 0.0001
- % * N: 50 points
-
- N = 50;
- lambda = 0.01;
- de = 0.0001;
- epsilon = linspace(de, (lambda/2)-de, N);
- k = zeros(1,N); % preallocate k
-
-
- %
- % * Call the bisection method for each epsilon value for each function and
- % keep the number of iterations needed.
- % * Plot the iterations k(epsilon) for each function
- %
- for i = 1:length(funs)
- for j = 1:N
- [a, b, k(j)] = bisection(funs{i}, a_0, b_0, epsilon(j), lambda);
- end
- subplot(1, length(funs), i)
- plot(epsilon, k, '-b', 'LineWidth', 1.0)
- title(titles(i), 'Interpreter', 'latex')
- xlabel('epsilon')
- ylabel('Iterations')
- end
-
-
|