sound=[3.2 8.8 2.75 6.55 4.25 4.5 5.5]; %拾音器数据
laser=[0.01 0.5 0.99 0.68 0.15 0.75 0.25]; %激光遥测仪数据
chemistry=[33 27 50 35 43 50 45 ]; %电化学数据
P = [sound;laser;chemistry];
T = [0 1 1 1 0 1 0]; %期望输出
%将矩阵P归一化至【0,1】之间
disp(P); %显示P矩阵
net = newff(P,T,6,{'tansig', 'tansig'}, 'trainlm'); %构建神经网络 ,隐含层tansig函数,输出层purelin函数。
net.trainParam.goal = 0.001; %训练目标误差
net.trainParam.epochs = 1000; %训练最大次数
net.trainParam.lr = 0.035; %学习速率
net.trainParam.show = 20; %限时训练结果的间隔步数
net.trainParam.time = 5 ; %训练允许时间5秒
net.trainParam.mc = 0.9; %动量因子
net.trainParam.showWindow = 1;
%划分训练、测试和验证数据的比例
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
net.divideFcn = ''; %将所有样本作为训练
net = train(net,P,T); %样本训练网络
Y = sim(net,P); %进行网络仿真
e=T-Y; %误差等于期望输出-实际输出
disp(e);
E=sumsqr(e); %计算误差平方和
MSE=mse(E)
net.b{1} %输出隐含层阈值
net.iw{1,1} %显示输入层到隐含层权值
net.b{2} %显示输出层阈值
net.lw{2,1} %输出隐含层到输出层权值
save ('net');
BP神经网路matlab程序.zip_BP_matlab
版权申诉
71 浏览量
2022-09-22
14:28:45
上传
评论
收藏 2KB ZIP 举报
寒泊
- 粉丝: 75
- 资源: 1万+
最新资源
- SVID_20240523_141155_1.mp4
- Code for the complete guide to tkinter tutorial
- 关于百货中心供应链管理系统.zip
- SimpleFolderIcon-master 修改Unity的Project下的文件夹图标
- A python Tkinter widget to display tile based maps
- A pure Python library for adding tables to a Tkinter application
- Vector资源文件.zip
- MobaXterm-Installer
- MicroMsg.xlsx
- 88-520告白(520气球).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0