-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_cost.m
49 lines (46 loc) · 1.43 KB
/
plot_cost.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
function [] = plot_cost(ACFT)
% Function:
% plot_cost(ACFT)
%
% Description:
% Plot the mission performance in a bar chart format
% Input:
% ACFT - Aircraft parameters
% MissionPerformance - Performance of aircraft defined for all the
% missions
% Output:
% plot
% Unwrap the structure
% Wrap the structure
Cost = ACFT.Cost;
Baseline = Cost.Baseline;
Parallel = Cost.Parallel;
Series = Cost.Series;
Hydrogen = Cost.Hydrogen;
Electric = Cost.Electric;
% Baseline
baseline = [Baseline.fuel_cents,0,0]/100;
% Parallel
parallel = [Parallel.fuel_cents,Parallel.elec_cents,0]/100;
% Series
series = [Series.fuel_cents,Series.elec_cents,0]/100;
% Hydorgen
hydrogen = [0,Hydrogen.elec_cents,Hydrogen.fuel_cents]/100;
% Electric
electric = [0,Electric.elec_cents,0]/100;
figure()
X = categorical({'baseline','parallel','series','hydrogen','electric'});
X = reordercats(X,{'baseline','parallel','series','hydrogen','electric'});
Y = [baseline;parallel;series;hydrogen;electric];
h = bar(X,Y,0.6,'stacked');
%ylim([0 500])
ylabel('Cost ($)')
% set 3 display names for the 3 handles
set(h, {'DisplayName'}, {'AVGAS','Electricity','Hydrogen'}')
set(gca,'fontSize',16)
legend('Orientation','horizontal','fontSize',14)
% Legend will show names for each color
h(1).FaceColor = [0.8500, 0.3250, 0.0980];
h(2).FaceColor = [0.4660, 0.6740, 0.1880];
h(3).FaceColor = [0.3010, 0.7450, 0.9330];
end