MATLAB神经网络预测问题

%神经网络算法

%这是我之前数学模型校内试的猪肉价格预测模型的算法。请参考。

清晰;clc

% P = 0:0.1:2 * pi;t = sin(P);pnew = 0:0.01:2 * pi;

p = 1985:2009;

T=[33139.6,...

33719.1,32773,34221.8,35281,36240.8,36964.6,38421,39300,41461.9, ...

44169.2,36283.6,40034.8,42256.3,43144.2,41633.6,41950.5,41776.2, ...

41381.8,42123.4,43319.1,41850.4,43989.5,46264,48204.8];

[pn,minp,maxp,tn,mint,maxt]=premnmx(P,T);%

net = newff(minmax(pn),[5 6 1],{'tansig ',' logsig ',' purelin'},' trainlm ');

% net = init(net);

net . train param . show = 50;%显示训练结果的间隔步骤。

net . train param . epochs = 10000;%最大训练步数

net . train param . goal = 0.01;%训练目标误差

net . train param . lr = 0.05;

[net,tr]=train(net,pn,TN);

pnew = 1985:2010;

pnewn=tramnmx(pnew,minp,maxp);

anewn=sim(net,pnewn);

tnew=postmnmx(anewn,mint,maxt)

%tnew=sim(net,pnew);

plot(P,T,' * ',pnew,tnew,' r ');

% P = 0:2 * pi;t = sin(P);pnew = 0:0.1:2 * pi;

%

%