# MATLAB代做|FPGA代做--灰色神经网络的预测算法

### 时间：2018-12-1 2:37:28 点击：

核心提示：-灰色神经网络的预测算法...

close all
clear
clc
% 16084
IN=1:42;
sr=zeros(1,42);
sr(1)=1080.94;
sr(2)=1083.03;
sr(3)=1162.8;
sr(4)=1155.61;
sr(5)=1092.82;
sr(6)=1099.26;
sr(7)=1161.06;
sr(8)=1258.05;
sr(9)=1299.03;
sr(10)=1298.3;
sr(11)=1440.22;
sr(12)=1641.3;
sr(13)=1672.21;
sr(14)=1612.73;
sr(15)=1658.64;
sr(16)=1752.42;
sr(17)=1837.99;
sr(18)=2099.29;
sr(19)=2675.47;
sr(20)=2786.33;
sr(21)=2881.07;
sr(22)=3183.98;
sr(23)=3841.27;
sr(24)=4109.65;
sr(25)=3820.7;
sr(26)=4471.03;
sr(27)=5218.83;
sr(28)=5552.3;
sr(29)=5954.77;
sr(30)=4871.78;
sr(31)=5261.56;
sr(32)=4383.39;
sr(33)=4348.54;
sr(34)=3472.71;
sr(35)=3693.11;
sr(36)=3433.35;
sr(37)=2736.1;
sr(38)=2775.72;
sr(39)=2397.37;
sr(40)=2293.78;
sr(41)=1728.79;
sr(42)=1871.16;
OUT=sr;
[X,minx,maxx,T,mint,maxt]=premnmx(IN,OUT);
q=50;
q1=0;
q0=70;
while(q1<q)
q=q0;
[M,N]=size(X);
[L,N]=size(T);
net=newff(minmax(X),[q,L],{'tansig','purelin'},'trainlm');
net.trainParam.lr=0.05;
net.trainParam.epochs=10000;
net.trainParam.goal=1e-6;
[net,tr]=train(net,X,T);
Y=sim(net,X);
Y=postmnmx(Y,mint,maxt);

%灰色关联分析，调整网络隐层节点
p=0.5;
e=0.5;
%此两个系数的设定是根据一些论文，已经实验的尝试得出的
an=repmat(net.b{1},1,N);
op=tansig(net.iw{1,1}*X+an);
op1=op';
T0=T';
T1=repmat(T0,1,q);
DIF=abs(T1-op1);
MIN=min(min(DIF));
MAX=max(max(DIF));
Si=(MIN+p*MAX)./(DIF+p*MAX);
ri=sum(Si)/N;
D=find(ri>=e);
[q0,q1]=size(D);
q0=q1;
end
q0;
ri;
D;
q=q1;

%进行测试

PRD=1:42;
PRD=PRD';
P=tramnmx(PRD,minx,maxx);
TNEW=sim(net,P');
TNEW=postmnmx(TNEW,mint,maxt);

t=1:42;
YY=OUT;
YC=TNEW;
figure
plot(t,YY,'r*',t,YC,'b--+')
RES0=YC-YY;
res0=RES0./YY;
figure
bar(t,res0)

QQ ：1224848052

• 百度搜索
• 查阅资料过程中
• 论坛发现
• 百度贴吧发现
• 朋友介绍
• 没有相关文章
• 大名：
• 内容：