THMMY's "Optimization Techniques" course assignments.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

45 líneas
906 B

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