X=m_data(:,1:4);T=m_data(:,5:6);
T=T';
%随机选取中心
C=X;
%定义delta平方为样本各点的协方差之和
delta=cov(X');
delta=sum(delta);
%隐含层输出H
for i=1:1:121
for j=1:1:121
H(i,j)=((X(i,:)-C(j,:)))*((X(i,:)-C(j,:))');
H(i,j)=exp(-H(i,j)./delta(j));
end
end
p=H;
%建模
%
err_goal=0.001;
sc=3;
net=newrb(X,T,err_goal,sc);
Y=sim(net,p);
E=T-Y;
SSE=sse(E);
MSE=mse(E);
%拟合图
figure;
for i=1:1:121
plot(T(i,1),T(i,2),'*');
end
hold on;
plot(Y,'r:');
title('RBF网络拟合曲线图');
legend('化验值','估计值');
ylabel('利用率');
xlabel('输入样本点');
axis([1,130,0,1]); |