1 Star 0 Fork 1

mc4th/snowland-FCE

forked from snowland.ltd/snowland-FCE 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
fce.m 3.73 KB
一键复制 编辑 原始数据 按行查看 历史
A.Star 提交于 2018-03-22 08:01 . 3比值
function TheResultMoHu = fce(a, d)
% a 为评价集标准值
% d 为待判样品值
%
% Program modification from http://www.pudn.com/Download/item/id/2798831.html
% code update on 2018-03-19
% A.Star, Snowland Co. Ltd, chenxiaolong12315@163.com
% Example:
% a=[0.9 0.9 0.9 0.9;
% 0.7 0.7 0.7 0.7;
% 0.5 0.5 0.5 0.5;
% 0.3 0.3 0.3 0.3;
% 0.1 0.1 0.1 0.1;
% ];
% d=[
% 0.92 0.9 0.86 0.88;
% 0.93 0.88 0.87 0.89;
% 0.67 0.68 0.78 0.79;
% 0.73 0.78 0.75 0.69;
% 0.58 0.52 0.57 0.43;
% 0.41 0.54 0.44 0.42;
% 0.31 0.27 0.22 0.4;
% 0.35 0.36 0.23 0.28;
% 0.16 0.18 0.19 0.18;
% 0.05 0.15 0.07 0.13;
% ];
% res = fce(a, d)
[m,n]=size(a);
[x,y]=size(d);
TheResultMoHu=[];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for s=1:x
for p=1:n
b(p)=d(s,p);
end
for i=1:n %计算每一个列的平均值
ColAverage(i)=0;
for j=1:m
ColAverage(i)=ColAverage(i)+a(j,i);
end
ColAverage(i)=ColAverage(i)/m;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ETotal = 0; %超标加权法计算权重
for j = 1: n
ETotal = ETotal + (b(j) / ColAverage(j));
end
for i = 1: n
EResult(i) = (b(i) / ColAverage(i)) / ETotal; %EResult为计算结果
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%使用隶属函数,做预处理对每一列进行排序
SortedMatrix=a;
for j=1:n
for i=1:m
for k=i:m
if SortedMatrix(i,j)>SortedMatrix(k,j)
tmp=SortedMatrix(i,j);
SortedMatrix(i,j)=SortedMatrix(k,j);
SortedMatrix(k,j)=tmp;
end
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%计算单因素隶属度
c=SortedMatrix;
for j = 1 : n
for i = 1 : m
k = 1;
if b(j) < c(k, j)
LSDResult(j, i) = 1;
end
if b(j) >= c(k, j) & b(j) < c(k + 1, j)
LSDResult(j, i) = ((c(k + 1, j) - b(j)) / (c(k + 1, j) - c(k, j)));
end
if b(j) >= c(k + 1, j)
LSDResult(j, i) = 0;
end
for k = 2 : m-1
if a(i, j) == c(k, j)
if k > 1 & k < m
if b(j) < c(k - 1, j)
LSDResult(j, i) = 0;
end
if b(j) >= c(k - 1, j) & b(j) < c(k, j)
LSDResult(j, i) = ((b(j) - c(k - 1, j)) / (c(k, j) - c(k - 1, j)));
end
if b(j) >= c(k, j) & b(j) < c(k + 1, j)
LSDResult(j, i) = ((c(k + 1, j) - b(j)) / (c(k + 1, j) - c(k, j)));
end
if b(j) >= c(k + 1, j)
LSDResult(j, i) = 0;
end
end
end
end
k = m;
if b(j) < c(k - 1, j)
LSDResult(j, i) = 0;
end
if b(j) >= c(k - 1, j) & b(j) < c(k, j)
LSDResult(j, i) = ((b(j) - c(k - 1, j)) / (c(k, j) - c(k - 1, j)));
end
if b(j) >= c(k, j)
LSDResult(j, i) = 1;
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%权重乘以单因素隶属度得到最终结果
R=LSDResult;
E=EResult;
E=[0.4236 0.227 0.1224 0.2771];
FuzzyEvalution=E*R;
TheResultMoHu=[TheResultMoHu;FuzzyEvalution];
end
end
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Matlab
1
https://gitee.com/mc4th/snowland-FCE.git
git@gitee.com:mc4th/snowland-FCE.git
mc4th
snowland-FCE
snowland-FCE
master

搜索帮助