Current location - Education and Training Encyclopedia - Graduation thesis - MATLAB neural network prediction problem
MATLAB neural network prediction problem
% neural network algorithm

This is the algorithm of the pork price prediction model that I tried in the school before. Please refer to.

Clear; clc

% P = 0:0. 1:2 * pi; t = sin(P); pnew = 0:0.0 1:2 * pi;

p = 1985:2009;

T=[33 139.6, ...

337 19. 1,32773,3422 1.8,3528 1,36240.8,36964.6,3842 1,39300,4 146 1.9, ...

44 169.2,36283.6,40034.8,42256.3,43 144.2,4 1633.6,4 1950.5,4 1776.2, ...

4 138 1.8,42 123.4,433 19. 1,4 1850.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; % shows the interval steps of training results.

net . train param . epochs = 10000; % Maximum number of training steps

net . train param . goal = 0.0 1; % training target error

net . train param . lr = 0.05;

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

pnew = 1985:20 10;

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;

%

%