[求助]大家谁帮我运行下我的程序啊?谢谢了!
我在办公室,由于办公室的电脑没装MATLAB,哪位大哥帮小弟下啊?看看程序正不正确
P=[5126.22 200.95 30.06 1304.43 932.14;
5649.93 204.41 29.80 1305.46 943.03;
5919.35 206.75 29.38 1306.58 953.03;
6213.24 206.90 29.09 1313.12 969.63;
6968.18 216.50 28.59 1321.63 986.16;
7656.96 227.61 28.06 1327.14 999.07;
8476.05 233.57 27.04 1334.23 1018.81;
11266.62 247.29 25.73 1341.77 1041.39]';
T=[63.65 22.6 18.45;
67.74 23.6 18.35;
74.245 23.7 17.39;
76.12 17.55 14.39;
77.66 15.31 14.43;
77.54 13.71 15.03;
72.53 11.98 15.56;
70.60 15.57 15.56]';
%输入向量的最大值和最小值
threshold=;
net=newff(threshold,,{'tansig','logsig'},'trainlm');
%训练次数为1000,训练目标为0.01,学习速率为0.1
net.trainParam.epochs=300;
net.trainParam.goal=0.01;
LP.lr=0.1;
net=train(net,P,T);
p_test=[14017.51 248.89 24.57 1352.39 1097.60;
16876.78 236.78 23.76 1360.26 1108.65;
25667.47 263.28 20.76 1380.50 1125.36;
29517.60 272.76 19.85 1387.40 1130.99;
33945.23 282.58 18.98 1394.34 1136.64]';
Y=sim(net,P_test);
out=
结果
P=[5126.22 200.95 30.06 1304.43 932.14;5649.93 204.41 29.80 1305.46 943.03;
5919.35 206.75 29.38 1306.58 953.03;
6213.24 206.90 29.09 1313.12 969.63;
6968.18 216.50 28.59 1321.63 986.16;
7656.96 227.61 28.06 1327.14 999.07;
8476.05 233.57 27.04 1334.23 1018.81;
11266.62 247.29 25.73 1341.77 1041.39]';
T=[63.65 22.6 18.45;
67.74 23.6 18.35;
74.245 23.7 17.39;
76.12 17.55 14.39;
77.66 15.31 14.43;
77.54 13.71 15.03;
72.53 11.98 15.56;
70.60 15.57 15.56]';
%输入向量的最大值和最小值
threshold=;
net=newff(threshold,,{'tansig','logsig'},'trainlm');
%训练次数为1000,训练目标为0.01,学习速率为0.1
net.trainParam.epochs=300;
net.trainParam.goal=0.01;
LP.lr=0.1;
net=train(net,P,T);
p_test=[14017.51 248.89 24.57 1352.39 1097.60;
16876.78 236.78 23.76 1360.26 1108.65;
25667.47 263.28 20.76 1380.50 1125.36;
29517.60 272.76 19.85 1387.40 1130.99;
33945.23 282.58 18.98 1394.34 1136.64]';
Y=sim(net,P_test);
out=
TRAINLM, Epoch 0/300, MSE 1957.36/0.01, Gradient 215841/1e-010
TRAINLM, Epoch 2/300, MSE 1891.8/0.01, Gradient 0/1e-010
TRAINLM, Minimum gradient reached, performance goal was not met.
??? Undefined function or variable 'P_test'.
cdwxgxiexie 你这个程序是哪个方面的?我看不太明白,但好象net.trainParam.epochs=300;不对吧?不是1000么? 我是做上海市需水预测的
我就用其他人的程序改了下自己的数据. 哦,怪不得,这个方面不知道,那你知道这些数据或者这个程序的每步的含义么?
如果了解了你旧该知道问题大概出在哪个地方吧?
我是不明白了。看下谁能帮下你吧。 呵呵
我也看不懂程序是什么意思的. ??? Undefined function or variable 'P_test'. 参考这个例子
clear,close all
% BP网络模型
%INITFF-网络初始化
%TRAINBP-用BP算法对网络进行训练
%SIMUFF-对网络进行仿真
p=[0.4617 0.3978 0.341 0.2975 0.2609 0.2315; 0.9365 0.8021 0.6875 0.5948 0.5145 0.4471;
0.4987 0.4294 0.3685 0.3218 0.2827 0.2516; 0.9709 0.8354 0.7209 0.6276 0.5489 0.4824;
0.3138 0.2641 0.2186 0.1705 0.1553 0.1327; 0.8851 0.7337 0.6127 0.5183 0.4396 0.3758;
0.6207 0.5363 0.4589 0.3959 0.3428 0.2988; 0.5029 0.4196 0.3519 0.2976 0.2516 0.214;
0.7795 0.6949 0.6242 0.5664 0.5154 0.471; 0.5079 0.4353 0.3713 0.323 0.2831 0.2504;
0.5068 0.4226 0.3509 0.297 0.2531 0.2182; 0.4318 0.3651 0.3064 0.2608 0.2226 0.1915;
0.6493 0.5592 0.4831 0.4207 0.3663 0.3214; 0.6413 0.5328 0.4445 0.376 0.3199 0.2753;
0.7142 0.6043 0.5106 0.4361 0.3738 0.3239; 0.3723 0.319 0.2732 0.238 0.2093 0.1855;
0.6894 0.6121 0.5432 0.4874 0.441 0.4019; 0.552 0.472 0.4053 0.3519 0.3058 0.2676;
0.3976 0.3214 0.2966 0.2145 0.1987 0.1643; 0.4766 0.4039 0.3429 0.2941 0.2517 0.2165;
0.5132 0.4353 0.3714 0.3204 0.2776 0.2418; 0.3893 0.3255 0.2747 0.2343 0.2 0.1715;
0.4158 0.3488 0.2914 0.2465 0.2084 0.179]';
t= ;
net=newff(minmax(p),,{'tansig' 'purelin'},'trainlm')
net.trainParam.goal = 0.002; % Sum-squared error goal.
net.trainParam.show = 10; % Frequency of progress displays (in epochs).
net.trainParam.epochs = 2000; % Maximum number of epochs to train.
net.trainParam.mc =0.02; % Momentum constant.
=train(net,p,t)
y1 = sim(net,p) P_test 应该是p_test
你用上面的例子改改 应该没问题!! 注意:(很容易出错)
P和t的行列一定要对应 谁能帮我改下马? 大哥们!帮忙改下啊 p_test 与P_test
你一个大写一个小写了
那个P,T 可以不一样的列
但行要一样 报错:P_test定义时候的p应该大写!
运行结果:
TRAINLM, Epoch 0/300, MSE 1918.02/0.01, Gradient 726918/1e-010
TRAINLM, Epoch 2/300, MSE 1894.7/0.01, Gradient 3.92085e-012/1e-010
TRAINLM, Minimum gradient reached, performance goal was not met.
out =
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
页:
[1]
2