1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| (1)function.m function [x,a,b,c,error1,error2]=GM11(x0,k)
n=length(x0); x1=[]; x1(1)=x0(1); for i=2:n x1(i)=x1(i-1)+x0(i); end for i=1:n-1 B(i,1)=-0.5*(x1(i)+x1(i+1)); B(i,2)=1; Y(i)=x0(i+1); end alpha=(B'*B)^(-1)*B'*Y'; a=alpha(1,1); b=alpha(2,1); d=b/a; c=x1(1)-d; x2(1)=x0(1); for i=1:n-1 x2(i+1)=c*exp(-a*i)+d; x(i+1)=x2(i+1)-x2(i); end for i=(n+1):(n+k) x2(i)=c*exp(-a*(i-1))+d; x(i)=x2(i)-x2(i-1); end for i=1:n error(i)=x(i)-x0(i); error1(i)=abs(error(i)); error2(i)=error1(i)/x0(i); end c=std(error1)/std(x0); (2)matlab操作代码 a=[390.6,412,320,559.2,380.8,542.4,553,310,561,300,632,540,406.2,313.8,576,587.6,318.5]'; k=1; t0=find(a<=320); [x,a,b,c,error1,error2]=GM11(t0,k) x=fix(x)
|