-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.m
More file actions
50 lines (44 loc) · 1.26 KB
/
model.m
File metadata and controls
50 lines (44 loc) · 1.26 KB
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
clear;
close all;
%%
%原始数据
a = [1, 3, 3, 6, 9;
0.1, 0.3, 0.3, 0.7, 0.7;
0.019, 0.027, 0.043, 0.043, 0.067
1.2, 2.53, 2.53, 3.82, 3.82];
[m, n] = size(a);
%评判指标
U(:, :, 1) = [0, 2;2, 5;5, 10;10, 15];
U(:, :, 2) = [0, 0.2;0.2, 0.4;0.4, 0.6;0.6, 1];
U(:, :, 3) = [0, 0.1; 0.1, 0.5; 0.5, 0.6; 0.6, 1];
U(:, :, 4) = [1, 1.5; 1.5, 2;2,3;3, 4];
%第一层权值
W1 = [0.8, 0.2]';
%第二层权值
W2 = [0.5, 0.5; 0.75, 0.25]';
R = zeros(4, 4, 5); %归一化矩阵
for i = 1: m
for j = 1:n
if a(i, j) > U(1, 1, i) && a(i, j) < U(1, 2, i)
R(1,i,j) = (a(i, j)- U(1, 1, i))/(U(1, 2, i)- U(1, 1, i));
elseif a(i, j) > U(2, 1, i) && a(i, j) < U(2, 2, i)
R(2,i,j) = (a(i, j)- U(2, 1, i))/(U(2, 2, i)- U(2, 1, i));
elseif a(i, j) > U(3, 1, i) && a(i, j) < U(3, 2, i)
R(3,i,j) = (a(i, j)- U(3, 1, i))/(U(3, 2, i)- U(3, 1, i));
elseif a(i, j) > U(4, 1, i) && a(i, j) < U(4, 2, i)
R(4,i,j) = (a(i, j)- U(4, 1, i))/(U(4, 2, i)- U(4, 1, i));
else a(i, j)< U(1, 1, i) || a(i, j) > U(4, 2, i);
disp('Data Error')
end
end
end
%% 判度计算
%综合判度
F = zeros(m, n);
for k = 1:n
%平面判度
F1 = R(:,1:2,k)* W2(:, 1);
% 纵向判度
F2 = R(:,3:4,k)* W2(:, 2);
F(:, k) = F1 * W1(1) + F2* W1(2);
end