28 lines
997 B
Matlab
28 lines
997 B
Matlab
function plotItersOverGamma(gamma, iterations, plot_title, filename)
|
|
% 3D plots a function
|
|
% fun: 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;
|
|
|
|
figure('Name', 'Iterations_over_gamma', 'NumberTitle', 'off');
|
|
set(gcf, 'Position', [100, 100, image_width, image_height]); % Set the figure size
|
|
plot(gamma, iterations, '*r', 'LineWidth', 2);
|
|
|
|
% Customize the plot
|
|
title(plot_title, 'Interpreter', 'latex', 'FontSize', 16); % Title of the plot
|
|
xlabel('\gamma') ;
|
|
ylabel('Iterations');
|
|
|
|
% save the figure
|
|
if strcmp(filename, '') == 0
|
|
print(gcf, filename, '-dpng', '-r300');
|
|
end
|
|
end |