/
plotOutputs.m
53 lines (47 loc) · 1.56 KB
/
plotOutputs.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function [ ] = plotOutputs( phat, half, time, efficiency, fileName )
% Plot the confidence interval of the estimated probability of convex,
% iteration time, and iteration efficiency vs. iteration number.
maxIte = length(phat);
num = [1:1:maxIte];
% Plot the estimated probability of convex
h1 = figure;
hold on;
axis([0 maxIte 0 1]);
plot(num, phat + half, '--');
area(phat + half, 'LineStyle', ':', 'FaceColor', 'y');
plot(num, phat - half,'--');
area(phat - half, 'LineStyle', ':', 'FaceColor', 'w');
plot(num, phat,'b', 'LineWidth', 2);
xlabel('Number of iterations');
ylabel('Estimated probability of convex');
figureHandle = gcf;
%# make all text in the figure to size 15 and bold
set(gca,'FontSize',40,'fontWeight','normal')
set(findall(figureHandle,'type','text'),'fontSize',40,'fontWeight','normal')
hold off;
saveas(h1, [pwd, '\outputs\', fileName, '_phat.fig']);
% Plot the iteration time
h2 = figure;
hold on;
axis auto;
plot(num, time,'b');
xlabel('Number of iterations');
ylabel('Iteration time');
figureHandle = gcf;
set(gca,'FontSize',40,'fontWeight','normal')
set(findall(figureHandle,'type','text'),'fontSize',40,'fontWeight','normal')
hold off;
saveas(h2, [pwd, '\outputs\', fileName, '_time.fig']);
% Plot the iteration efficiency
h3 = figure;
hold on;
axis auto;
plot(num, efficiency,'b');
xlabel('Number of iterations');
ylabel('Iteration efficiency');
figureHandle = gcf;
set(gca,'FontSize',25,'fontWeight','normal')
set(findall(figureHandle,'type','text'),'fontSize',25,'fontWeight','normal')
hold off;
saveas(h3, [pwd, '\outputs\', fileName, '_efficiency.fig']);
end