数学建模学习笔记(二十二)灰色预测(下下)GM(2,1)

2022-06-14 09:55:46 浏览数 (1)

GM(2,1) 理论推导:

例子:

matlab代码:

代码语言:javascript复制
clc,clear
x0=[41,49,61,78,96,104];
n=length(x0);
x1=cumsum(x0);
a_x0=diff(x0);
a_x0=[0,a_x0]
for i=2:n
    z(i)=0.5*(x1(i) x1(i-1));
end
B=[-x0(2:end)',-z(2:end)',ones(n-1,1)];
Y=a_x0(2:end)';
u=BY
x=dsolve('D2x a1*Dx a2*x=b','x(0)=c1,x(5)=c2');
x=subs(x,{'a1','a2','b','c1','c2'},{u(1),u(2),u(3),x1(1),x1(6)});
yuce=subs(x,'t',0:n-1);
digits(6),x=vpa(x)
x0_hat=[yuce(1),diff(yuce(1:n-1))]
epsilon=x0-x0_hat
delta=abs(epsilon./x0)

附:预测类题目的模型选择表

0 人点赞