|
- function plotConvCompare(points_1, title_1, points_2, title_2, points_3, title_3, Min_point, plot_title, filename)
- % 3D plots a function
- % points: The points to plot
- % contur_fun: The function for contour plot
- % x_lim: The range for x axis. ex: [-2, 2]
- % y_lim: The range for y axis. ex: [0, 2]
- % size: The number of points for each axis
- % plot_title: The latex title for the plot
- % filename: The filename to save the plot (if exists)
- %
-
- global image_width,
- global image_height;
-
- distances_1 = sqrt((points_1(:,1) - Min_point(1)).^2 + (points_1(:,2) - Min_point(2)).^2);
- distances_2 = sqrt((points_2(:,1) - Min_point(1)).^2 + (points_2(:,2) - Min_point(2)).^2);
- distances_3 = sqrt((points_3(:,1) - Min_point(1)).^2 + (points_3(:,2) - Min_point(2)).^2);
-
-
- % 2D plot
- figure('Name', 'Convergence compare', 'NumberTitle', 'off');
- set(gcf, 'Position', [100, 100, image_width, image_height]); % Set the figure size
- title(plot_title, 'Interpreter', 'latex', 'FontSize', 16); % Title of the plot
-
- % One
- subplot(3, 1, 1);
- plot(distances_1, '-o');
- % Customize the plot
- ylabel(title_1, 'Interpreter', 'none');
- xlabel('Step');
- grid on
-
- % One
- subplot(3, 1, 2);
- plot(distances_2, '-o');
- % Customize the plot
- ylabel(title_2, 'Interpreter', 'none');
- xlabel('Step');
- grid on
-
- % One
- subplot(3, 1, 3);
- plot(distances_3, '-o');
- % Customize the plot
- ylabel(title_3, 'Interpreter', 'none');
- xlabel('Step');
- grid on
-
-
- % save the figure
- if strcmp(filename, '') == 0
- print(gcf, filename, '-dpng', '-r300');
- end
- end
|