1.matlab

clear all;clc;
x0=[
 976.04,995.53,1018.5,1001.35,1150.06,1309.7,1355.03,1424.91

]' ;
N=12;
 n=length( x0 ) ;
 x1=cumsum( x0 ) ;
 B=[ -0.5* (x1( 1 : n-1)+x1( 2 : n ) ) , ones( n-1 ,1)];
 Y=x0( 2 : n ) ;
 u=B\Y
 x=dsolve ( 'Dx+a*x=b ' , ' x(0)=x0 ' ) ;
 x=subs ( x,{ ' a ' , ' b ' , ' x0 ' } ,{ u( 1 ) , u( 2 ) , x1( 1 ) } ) ;
 yuce1=subs ( x , ' t ', [ 0 : n+N]);

 yuce1=eval( yuce1 ) ;
 y=vpa( x ,12 )  %12个有效位数
 result=[x0( 1 ) ,diff( yuce1 ) ] ;
 result_new=result( n+2: end );
 format bank
 result_new'

 2.

clc,clear
x0=[1.7524     1.8888     2.0790     2.4075     2.3808     2.4436     2.8495     3.2664
]';
n=length(x0);
lamda=x0(1:n-1)./x0(2:n);
range=minmax(lamda');
x1=cumsum(x0);
B=[-0.5*(x1(1:n-1)+x1(2:n)),ones(n-1,1)];
Y=x0(2:n);
u=B\Y;
x=dsolve('Dx+a*x=b','x(0)=x0');
x=subs(x,{'a','b','x0'},{u(1),u(2),x1(1)});
yuce1=subs(x,'t',[0:n-1]);
yuce1=eval(yuce1);
y=vpa(x,12);
yuce=[x0(1),diff(yuce1)];
epsilon=x0'-yuce;
delta=abs(epsilon./x0');
jingdu=1-mean(delta)
yuce1=subs(x,'t',[0:n+8]);
yuce1=eval(yuce1);
y=vpa(x,12);
yuce=[x0(1),diff(yuce1)];
yuce_new=yuce(n+1:end)

 

posted on 2016-01-21 20:43  planet  阅读(978)  评论(0编辑  收藏  举报