求各位大神指教啊,用灰色预测法为什么下面的程序显示不出来图像呢?但是也没有提示有任何错误啊?
x0=[9.7734 1.2360 1.4915 1.9048 2.0513 2.0635 1.9499 1.7956 2.0205 2.2281 2.4072;
%由数列x0形成数x1
s=0;
for i=1:11;
s=s+x0(i);
x1(i)=s
end
%由数列x1形成矩阵B
for j=1:10;
B(j,1)=-(x1(j+1)+x1(j))/2;
B(j,2)=1;
end
%由数列x0形成矩阵C
for k=1:10;
C(k,1)=x0(k+1);
end
%计算出估计值a1,a和u
a1=inv(B'*B)*B'*C;
a=a1(1);
u=a1(2);
%求出原始数列x1的预测值数列x2
for k=0:18;
x2(k+1)=(x0(1)-u/a)*exp(-a*k)+u/a
end
%求出原时数列x0的预测值数列x3
x3(1)=x0(1);
for k=1:18;
x3(k+1)=(1-exp(a))*(x0(1)-u/a)*exp(-a*k)
end
xx=1:11;
plot(xx,x0,'-ro',1:18,x3,'--b*')
x0=[9.7734 1.2360 1.4915 1.9048 2.0513 2.0635 1.9499 1.7956 2.0205 2.2281 2.4072;
%由数列x0形成数x1
s=0;
for i=1:11;
s=s+x0(i);
x1(i)=s
end
%由数列x1形成矩阵B
for j=1:10;
B(j,1)=-(x1(j+1)+x1(j))/2;
B(j,2)=1;
end
%由数列x0形成矩阵C
for k=1:10;
C(k,1)=x0(k+1);
end
%计算出估计值a1,a和u
a1=inv(B'*B)*B'*C;
a=a1(1);
u=a1(2);
%求出原始数列x1的预测值数列x2
for k=0:18;
x2(k+1)=(x0(1)-u/a)*exp(-a*k)+u/a
end
%求出原时数列x0的预测值数列x3
x3(1)=x0(1);
for k=1:18;
x3(k+1)=(1-exp(a))*(x0(1)-u/a)*exp(-a*k)
end
xx=1:11;
plot(xx,x0,'-ro',1:18,x3,'--b*')