2014.4.11~4.20 预测价格为 5.9535
>> %灰色预测模型程序
clear
syms a b;
c=[a b]';
A=[5.76 5.92 5.91 5.92 5.93 5.93 5.93 5.94 5.94 5.95 5.95 5.94 ];% 原始序列
B=cumsum(A);%累加
n=length(A);
for i=1:(n-1)
C(i)=(B(i)+B(i+1))/2;
end
%计算待定参数
D=A;
D(1)=[];
D=D';
E=[-C; ones(1,n-1)];
c=inv(E*E')*E*D;
c=c';
a=c(1);
b=c(2);
%预测 往后预测1个数据(即4.11-4.20价格)
F=[];F(1)=A(1);
for i=2:(n+1)
F(i)=(A(1)-b/a)/exp(a*(i-1))+b/a;
end
G=[];G(1)=A(1);
for i=2:(n+1)
G(i)=F(i)-F(i-1);
end
t1=2002:2013;
t2=2002:2014;
G
plot(t1,A,'o',t2,G)
G =
5.7600 5.9155 5.9189 5.9224 5.9258 5.9293 5.9327 5.9362 5.9396 5.9431 5.9465 5.9500 5.9535