部分实验代码
%输入层
x=inputn(:,k);
%输入层结算
for i=1:I
for j=1:M
u(i,j)=exp(-(x(i)-c(j,i))^2/b(j,i));
end
end
%模糊规则计算
for i=1:M
w(i)=u(1,i)*u(2,i)*u(3,i)*u(4,i)*u(5,i)*u(6,i);
end
addw=sum(w);
for i=1:M
yi(i)=p0_1(i)+p1_1(i)*x(1)+p2_1(i)*x(2)+p3_1(i)*x(3)+p4_1(i)*x(4)+p5_1(i)*x(5)+p6_1(i)*x(6);
end
addyw=yi*w';
%输出及误差函数计算
yn(k)=addyw/addw;
e(k)=outputn(k)-yn(k);
%计算p的变化值
d_p=zeros(M,1);
d_p=xite*e(k)*w./addw;
d_p=d_p';
%计算b变化值
d_b=0*b_1;
for i=1:M
for j=1:I
d_b(i,j)=xite*e(k)*(yi(i)*addw-addyw)*(x(j)-c(i,j))^2*w(i)/(b(i,j)^2*addw^2);
end
end
%更新c变化值
for i=1:M
for j=1:I
d_c(i,j)=xite*e(k)*(yi(i)*addw-addyw)*2*(x(j)-c(i,j))*w(i)/(b(i,j)*addw^2);
end
end
数据集采用的是水质检测的六个指标
其输出如下