資源簡介
壓縮包內(nèi)包含單變量及多變量灰色預(yù)測matlab程序,以及多變量灰色模型的建模過程文章

代碼片段和文件信息
%灰色GM模型
%原始數(shù)據(jù)的處理方法是累加法
%應(yīng)用的數(shù)學(xué)模型是GM(1,1)
clc;
clear?all;
y=input(‘輸入原始數(shù)據(jù)‘);%輸入數(shù)據(jù)請用如下所示[48.7?57.17?68.76?92.15];
n=length(y);
yy=ones(n1);
yy(1)=y(1);
for?i=2:n
????yy(i)=yy(i-1)+y(i);
end
B=ones(n-12);
for?i=1:n-1
????B(i1)=-(yy(i)+yy(i+1))/2;
????B(i2)=1;
end
BT=B‘;
for?j=1:n-1
????YN(j)=y(j+1);
end
YN=YN‘;
A=inv(BT*B)*BT*YN;
a=A(1);
u=A(2);
t=u/a;
t_test=input(‘請輸入要預(yù)測的個數(shù)‘);
i=1:t_test+n;
yys(i+1)=(y(1)-t)*exp(-a.*i)+t;
yys(1)=y(1);
for?j=n+t_test:-1:2
????ys(j)=yys(j)-yys(j-1);
end
x=1:n;
xs=2:n+t_test;
yn=ys(2:n+t_test);
plot(xy‘^r‘xsyn‘*-b‘);
det=0;
for?i=2:n
????det=det+abs(yn(i-1)-y(i));
end
det=det/(n-1);
disp([‘百分絕對誤差為:‘num2str(det)‘%‘]);
disp([‘預(yù)測值為:‘num2str(ys(n+1:n+t_test))]);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????814??2012-09-17?10:05??gm.m
?????文件?????????878??2013-04-10?20:28??gm1n.m
?????文件??????137484??2011-04-13?18:39??Matlab.pdf
- 上一篇:一級倒立擺的PID控制
- 下一篇:Matlab與串口通信基礎(chǔ)
評論
共有 條評論