用MATLAB训练BP神经网络显示未定义与 'struct' 类型的输入参数相对应的函数 'train'。
Afficher commentaires plus anciens
一下是我根据网课学习写的代码,18x5x1的三层BP神经网络,隐层神经元的激励函数为S型正切函数tansig。选取S型对数函数tansig作为输出层神经元的激励函数。win10 64位 matlab2019b
clear all
clc
p_train=[0.012 0.025 0.036 0.042 0.021 0.026 0.069 0.012 0.085 0.163 0.142 0.056 0.046 0.028 0.046 0.210 0.060 0.030;
0.035 0.056 0.190 0.042 0.063 0.142 0.036 0.058 0.020 0.042 0.063 0.075 0.009 0.062 0.075 0.001 0.065 0.040;
0.156 0.264 0.036 0.021 0.032 0.084 0.056 0.035 0.162 0.082 0.046 0.156 0.025 0.261 0.042 0.260 0.321 0.005;
0.036 0.058 0.042 0.159 0.056 0.283 0.052 0.041 0.056 0.041 0.056 0.025 0.052 0.251 0.036 0.230 0.123 0.023;
0.009 0.352 0.042 0.258 0.056 0.025 0.023 0.256 0.012 0.039 0.125 0.321 0.052 0.019 0.022 0.213 0.125 0.023;
0.026 0.036 0.001 0.063 0.265 0.021 0.156 0.021 0.036 0.021 0.036 0.060 0.250 0.125 0.021 0.002 0.321 0.123;
0.125 0.062 0.021 0.265 0.023 0.036 0.120 0.005 0.062 0.046 0.021 0.054 0.021 0.002 0.123 0.123 0.032 0.021;
0.001 0.026 0.062 0.321 0.052 0.062 0.021 0.052 0.042 0.001 0.054 0.042 0.052 0.420 0.062 0.032 0.052 0.042;
0.002 0.123 0.020 0.251 0.260 0.062 0.062 0.020 0.336 0.006 0.024 0.052 0.063 0.006 0.210 0.123 0.023 0.222;
0.040 0.030 0.123 0.060 0.120 0.230 0.152 0.063 0.050 0.230 0.020 0.132 0.002 0.140 0.200 0.006 0.253 0.066];
t_train=[0.123 0.230 0.210 0.006 0.250 0.212 0.414 0.216 0.006 0.125];
p_test=[0.023 0.058 0.125 0.013 0.154 0.064 0.018 0.046 0.125 0.035 0.030 0.033 0.164 0.027 0.016 0.037 0.017 0.015];
t_test=[0.067];
%%
newff(p_train,t_train,[5,1],{'tansig','tansig','tansig'},'traingdx')
%%
net.trainParam.epochs=500;
net.trainParam.goal=0.005;
net.trainParam.ir=0.001;
%%
net=train(net,p_train,t_train);
%[net,tr]=train(net,p_train,t_train);
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur 矩阵和数组 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!