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.
 
 

28 líneas
997 B

  1. function plotItersOverGamma(gamma, iterations, plot_title, filename)
  2. % 3D plots a function
  3. % fun: The points to plot
  4. % contur_fun: The function for contour plot
  5. % x_lim: The range for x axis. ex: [-2, 2]
  6. % y_lim: The range for y axis. ex: [0, 2]
  7. % size: The number of points for each axis
  8. % plot_title: The latex title for the plot
  9. % filename: The filename to save the plot (if exists)
  10. %
  11. global image_width,
  12. global image_height;
  13. figure('Name', 'Iterations_over_gamma', 'NumberTitle', 'off');
  14. set(gcf, 'Position', [100, 100, image_width, image_height]); % Set the figure size
  15. plot(gamma, iterations, '*r', 'LineWidth', 2);
  16. % Customize the plot
  17. title(plot_title, 'Interpreter', 'latex', 'FontSize', 16); % Title of the plot
  18. xlabel('\gamma') ;
  19. ylabel('Iterations');
  20. % save the figure
  21. if strcmp(filename, '') == 0
  22. print(gcf, filename, '-dpng', '-r300');
  23. end
  24. end