自创建神经网络, 使用传递函数(激活函数)为logsig(S型对数函数)。具体实现如下:
figure(2)
[C,h] =contour(Wrange,Brange,ES); %作等高线图,ES为高
%返回等高线矩阵C,列向量h是线或对象的句柄,一条线一个句柄,这些被用作CLABEL的输入,
%每个对象包含每个等高线的高度
%A contour graph displays isolines of matrix Z. Label the contour lines using clabel
% contour(X,Y,Z,n), and contour(X,Y,Z,v) draw contour plots of Z.
% X and Y specify the x- and y-axis limits. When X and Y are matrices,
%they must be the same size as Z, in which case they specify a surface,
%as defined by the surf function.
% If X or Y is irregularly spaced,
% contour calculates contours using a regularly spaced contour grid,
% then transforms the data to X or Y.
clabel(C,h) %标上高度值
colormap cool %背景的颜色cool
axis('equal')
hold on
plot(x1,y1,'r+')
plot(xx,yy,'b*') %作矩阵变化曲线
hold off
figure(3)
plot(err) %作误差曲线
err