-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.m
182 lines (138 loc) · 5.35 KB
/
main.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
%%Set The Inputs:
Input_vector = [0 2 3 5 8];
%% Calculate The Alarm
A_Matrix_1 = [1 -1/14 0 0 0 0 0 0 0 0;
0 0 1 -1/15 0 0 0 0 0 0;
0 0 0 0 1 -1/20 0 0 0 0;
0 0 0 0 0 0 1 -1/13 0 0;
0 0 0 0 0 0 0 0 1 -1/10 ];
A_Matrix_2 = [ 1 0 0 0 0;
1 0 0 0 0;
0 1 0 0 0;
0 1 0 0 0;
0 0 1 0 0;
0 0 1 0 0;
0 0 0 1 0;
0 0 0 1 0;
0 0 0 0 1;
0 0 0 0 1 ];
A_Matrix_3 = [1 0 0 0 0 1 0 0 0 1 0 1 1 0 1;
0 1 0 0 0 1 1 0 0 1 1 0 1 1 1;
0 0 1 0 0 0 1 1 0 1 1 1 1 1 1;
0 0 0 1 0 0 0 1 1 0 1 0 1 1 1;
0 0 0 0 1 0 0 0 1 0 0 1 0 1 1];
A_Matrix_4 = [ 1 0 0 0 0;
1 0 0 0 0;
1 0 0 0 0;
1 0 0 0 0;
1 0 0 0 0;
0 1 0 0 0;
0 1 0 0 0;
0 1 0 0 0;
0 1 0 0 0;
0 0 1 0 0;
0 0 1 0 0;
0 0 1 0 0;
0 0 0 1 0;
0 0 0 1 0;
0 0 0 0 1];
A_bias_1 = [-1 1 -1 1 -1 1 -1 1 -1 1];
A_bias_2 = [-1 -1 -1 -1 -1];
A_bias_3 = [0 0 0 0 0 -1 -1 -1 -1 -2 -2 -2 -3 -3 -4];
A_layer_1 = (Input_vector * A_Matrix_1) + A_bias_1;
A_layer_1(A_layer_1 > 0)=1;
A_layer_1(A_layer_1 <= 0)=0;
A_layer_2 = (A_layer_1 * A_Matrix_2) + A_bias_2;
A_layer_2(A_layer_2 > 0)=1;
A_layer_2(A_layer_2 <= 0)=0;
A_layer_3 = (A_layer_2 * A_Matrix_3) + A_bias_3;
A_layer_3(A_layer_3 == 1)=1;
A_layer_3(A_layer_3 <= 0)=0;
A_layer_4 = (A_layer_3 * A_Matrix_4);
%% Calculate The Warning
W_Matrix_1 = [1/13 -1/30 0 0 0 0 0 0 0 0;
0 0 1/14 -1/32 0 0 0 0 0 0;
0 0 0 0 1/19 -1/40 0 0 0 0;
0 0 0 0 0 0 1/12 -1/28 0 0;
0 0 0 0 0 0 0 0 1/9 -1/22 ];
W_Matrix_2 = [ 1 0 0 0 0;
1 0 0 0 0;
0 1 0 0 0;
0 1 0 0 0;
0 0 1 0 0;
0 0 1 0 0;
0 0 0 1 0;
0 0 0 1 0;
0 0 0 0 1;
0 0 0 0 1 ];
W_Matrix_3 = [1 0 0 0 0 1 0 0 0 1 0 1 1 0 1;
0 1 0 0 0 1 1 0 0 1 1 0 1 1 1;
0 0 1 0 0 0 1 1 0 1 1 1 1 1 1;
0 0 0 1 0 0 0 1 1 0 1 0 1 1 1;
0 0 0 0 1 0 0 0 1 0 0 1 0 1 1];
W_Matrix_4 = [ 1 0 0 0 0;
1 0 0 0 0;
1 0 0 0 0;
1 0 0 0 0;
1 0 0 0 0;
0 1 0 0 0;
0 1 0 0 0;
0 1 0 0 0;
0 1 0 0 0;
0 0 1 0 0;
0 0 1 0 0;
0 0 1 0 0;
0 0 0 1 0;
0 0 0 1 0;
0 0 0 0 1];
W_bias_1 = [-1 1 -1 1 -1 1 -1 1 -1 1];
W_bias_2 = [-1 -1 -1 -1 -1];
W_bias_3 = [0 0 0 0 0 -1 -1 -1 -1 -2 -2 -2 -3 -3 -4];
W_layer_1 = (Input_vector * W_Matrix_1) + W_bias_1;
W_layer_1(W_layer_1 > 0)=1;
W_layer_1(W_layer_1 <= 0)=0;
W_layer_2 = (W_layer_1 * W_Matrix_2) + W_bias_2;
W_layer_2(W_layer_2 > 0)=1;
W_layer_2(W_layer_2 <= 0)=0;
W_layer_3 = (W_layer_2 * W_Matrix_3) + W_bias_3;
W_layer_3(W_layer_3 == 1)=1;
W_layer_3(W_layer_3 <= 0)=0;
W_layer_4 = (W_layer_3 * W_Matrix_4);
%% Results
% Normal
if A_layer_4(1) ==0&& A_layer_4(2) ==0&&A_layer_4(3) ==0 &&A_layer_4(4) ==0&&A_layer_4(5) ==0&& W_layer_4(1) ==0&& W_layer_4(2) ==0&&W_layer_4(3) ==0&&W_layer_4(4) ==0&&W_layer_4(5) ==0;
msgbox('Normal');
end
% Alarm
if A_layer_4(1) == 1
msgbox('Alarm !! By Individual Parameter');
end
if A_layer_4(2) ==1
msgbox('Alarm !! By Pairs Parameter');
end
if A_layer_4(3) ==1
msgbox('Alarm !! By Triples Parameters');
end
if A_layer_4(4) ==1
msgbox('Alarm !! By Quad Parameters');
end
if A_layer_4(5) ==1
msgbox('Alarm !! By Five Parameters');
end
% Warning
if W_layer_4(1) ==1
msgbox('Warning !! By Individual Parameter');
end
if W_layer_4(2) ==1
msgbox('Warning !! By Pairs Parameter');
end
if W_layer_4(3) ==1
msgbox('Warning !! By Triples Parameter');
end
if W_layer_4(4) ==1
msgbox('Warning !! By Quad Parameter');
end
if W_layer_4(5) ==1
msgbox('Warning !! By Five Parameter');
end
%-------