This repository was archived by the owner on Mar 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNitration.m
102 lines (77 loc) · 2.31 KB
/
Nitration.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
close all;clear all
% Sensitivity analysis
E0n = 0.140;
P0n = 0.574;
S0n = 0.286;
W0n = [E0n P0n S0n];
AHP_nitration = [0.338806791 0.336065574 0.2;
0.352953382 0.295081967 0.2;
0.308239827 0.352459016 0.2;
0 0.016393443 0.4];
TOPSIS_nitration = [0.585913235 0.589943325 0.377964473;
0.610377549 0.517999017 0.377964473;
0.533052463 0.618721048 0.377964473;
0 0.028777723 0.755928946];
Wn = []; %deifne matrix of unknown size
Rn = [];
Tn = [];
Smaxn = [];
Sminn= [];
Pin = [];
for En= [0:0.005:1]
for Pn = [0:0.005:1-En]
Sn = 1-En-Pn;
Wn = [Wn; En Pn Sn]; % use ";" to go to next row of matix
Rn = [Rn; (AHP_nitration*Wn(end,:)')']; % AHP score calculation
Tn = TOPSIS_nitration.*Wn(end,:);
Vmaxn = max(Tn);
Vminn= min(Tn);
Smaxn = [(sum(((Tn-Vmaxn).^2),2)).^0.5]';
Sminn = [(sum(((Tn-Vminn).^2),2)).^0.5]';
Pin = [Pin; Sminn./(Smaxn+Sminn)];
end
end
%AHP
[Cn,In] = max(Rn,[],2);
%I_AHPn = sort(In,2);
% [Bn,~,ibn] = unique(In,'rows');
% numoccurencesn = accumarray(ibn,1);
% indicesn = accumarray(ibn, find(ibn), [], @(rows){rows}); %the find(ib) simply generates (1:size(a,1))'
An = [Wn In];
%TOPIS
[C2n,I2n] = max(Pin,[],2);
%I_TOPSISn = sort(I2n,2);
%[B2n,~,ib2n] = unique(I2n,'rows');
%numoccurences2n = accumarray(ib2n,1);
%indices2n = accumarray(ib2n, find(ib2n), [], @(rows){rows}); %the find(ib) simply generates (1:size(a,1))'
A2n = [Wn I2n];
%AHP plot
l=length(An);
An(l+1,:)=[1 0 0 1];
An(l+2,:)=[0 1 0 4];
An(l+3,:)=[0 0 1 1];
figure;
colormap(brewermap(4,'Paired'))
[hg,htick,hcb] = tersurf(An(:,1),An(:,2),An(:,3),An(:,4));
hlabels=terlabel('Economic potential','Performance','Safety and Environment');
set(gcf,'paperpositionmode','auto','inverthardcopy','off')
ax = gca;
c = ax.Colorbar;
c.Ticks = 1:4;
c.TickLabels = {'H-ZSM-5','H-Y','H-Mordenite','No catalyst'};
figExport(12,8,'AHP_nitration')
%TOPSIS plot
l=length(A2n);
A2n(l+1,:)=[1 0 0 1];
A2n(l+2,:)=[0 1 0 4];
A2n(l+3,:)=[0 0 1 1];
figure;
colormap(brewermap(4,'Paired'))
[hg,htick,hcb] = tersurf(A2n(:,1),A2n(:,2),A2n(:,3),A2n(:,4));
hlabels=terlabel('Economic potential','Performance','Safety and Environment');
set(gcf,'paperpositionmode','auto','inverthardcopy','off')
ax = gca;
c = ax.Colorbar;
c.Ticks = 1:4;
c.TickLabels = {'H-ZSM-5','H-Y','H-Mordenite','No catalyst'};
figExport(12,8,'TOPSIS_nitration')