BP神经网络 function [W,err]=BPTrain(data,label,hiddenlayers,nodes,type) %Train the bp artial nueral net work %input data,label,layers,nodes,type %data:dim*n %label:1*n %layers:m:number of hidden layers %nodes:num_1;num_2...num_m %type==1:create and train…
close allclear allclcload x.txt; load y.txt; inputs = x';targets = y; % 创建一个模式识别网络(两层BP网络),同时给出中间层神经元的个数,这里使用20hiddenLayerSize = 20;net = patternnet(hiddenLayerSize); % 对数据进行预处理,这里使用了归一化函数(一般不用修改)% For a list of all processing functions type: help nn…