-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPlot_PMF_CDF.m
70 lines (57 loc) · 2.09 KB
/
Plot_PMF_CDF.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
function Plot_PMF_CDF(xvector1, yvector1, X1, Y1, Y2,figure1)
%CREATEFIGURE(XVECTOR1, YVECTOR1, X1, Y1, Y2)
% XVECTOR1: bar xvector
% YVECTOR1: bar yvector
% X1: vector of x data
% Y1: vector of y data
% Y2: vector of y data
% Auto-generated by MATLAB on 12-Mar-2019 15:49:00
% Create figure
colormap(jet);
% Create subplot
subplot1 = subplot(2,1,1,'Parent',figure1);
hold(subplot1,'on');
% Create bar
bar(xvector1,yvector1,'DisplayName','PMF','Parent',subplot1,...
'FaceColor',[0.862745106220245 0.862745106220245 0.862745106220245],...
'EdgeColor',[0.494117647409439 0.494117647409439 0.494117647409439]);
% Create plot
plot(X1,Y1,'Parent',subplot1,'DisplayName','PDF','LineWidth',2,...
'Color',[0.2 0.5 0.8]);
% Create xlabel
xlabel('Net Present Value (NPV) (in million USD)','FontWeight','bold',...
'FontName','Times New Roman');
% Create ylabel
ylabel('Probability Mass Function (PMF)','FontWeight','bold',...
'FontName','Times New Roman');
% Uncomment the following line to preserve the X-limits of the axes
% xlim(subplot1,[0 180]);
% Uncomment the following line to preserve the Y-limits of the axes
% ylim(subplot1,[0 0.02]);
box(subplot1,'on');
grid(subplot1,'on');
% Set the remaining axes properties
set(subplot1,'FontName','Times New Roman');
% Create legend
legend(subplot1,'show');
% Create subplot
subplot2 = subplot(2,1,2,'Parent',figure1);
hold(subplot2,'on');
% Create plot
plot(X1,Y2,'Parent',subplot2,'LineWidth',2,'Color',[0.2 0.5 0.8]);
% Create xlabel
xlabel('Net Present Value (NPV) (in million USD)','FontWeight','bold',...
'FontName','Times New Roman');
% Create ylabel
ylabel('Cumulative Distribution Function (CDF)','FontWeight','bold',...
'FontName','Times New Roman');
% Uncomment the following line to preserve the X-limits of the axes
% xlim(subplot2,[0 180]);
% Uncomment the following line to preserve the Y-limits of the axes
% ylim(subplot2,[0 1]);
box(subplot2,'on');
grid(subplot2,'on');
% Set the remaining axes properties
set(subplot2,'FontName','Times New Roman','YTick',[0 0.05 0.5 0.95 1],...
'YTickLabel',{'','0.05','0.5','0.95',''});
end