THMMY's "Optimization Techniques" course assignments.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

bisection_epsilonFixed.m 927 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. %
  2. % Keeping epsilon fixed, test the iteration needed for different lambda
  3. % values.
  4. %
  5. % Clear workspace and load the functions and region
  6. clear
  7. funGivenEnv;
  8. % * epsilon: e = 0.001
  9. % * lambda: l > 2e = 0.001
  10. % * dl: A small step away from 2e
  11. % dl = 0.0001
  12. % * lambda_max: 0.1
  13. % * size: 25 points
  14. size = 25;
  15. epsilon = 0.001;
  16. dl = 0.0001;
  17. lambda_max= 0.1;
  18. lambda = linspace(2*epsilon + dl, lambda_max, size);
  19. k = zeros(1,size);
  20. %
  21. % * Call the bisection method for each lambda value for each function and
  22. % keep the number of iterations needed.
  23. % * Plot the iterations k(lambda) for each function
  24. %
  25. i = 0;
  26. for f = funs
  27. i = i + 1;
  28. j = 0;
  29. for l = lambda
  30. j = j + 1;
  31. [a, b, k(j)] = bisection(f, a_0, b_0, epsilon, l);
  32. end
  33. subplot(1, 3, i)
  34. plot(lambda, k, '-b', 'LineWidth', 1.0)
  35. title(titles(i), 'Interpreter', 'latex')
  36. xlabel('lambda')
  37. ylabel('Iterations')
  38. end