多项式拟合法就是利用matlab自带的函数polyfit来处理.其函数原型如下(来自matlab帮助): polyfit fit polynomial to data. polyfit(x,y,n) finds the coefficients of a polynomial p(x) of degree n that fits the data, p(x(i))~=y(i), in a least-sq ares sense. [p,s] = polyfit(x,y,n) ret rns the polynomial coefficients p and a str ct re s for se with polyval to obtain error estimates on predictions. if the errors in the data, y, are independent normal with constant variance, polyval will prod ce error bo nds which contain at least 50% of the predictions. the str ct re s contains the cholesky factor of the vandermonde matrix (r), the degrees of freedom (df), and the norm of the resid als (normr) as fields. 同样是对玻尔兹曼常数测量实验的数据进行处理,在线性回归的基础上,受到方法一的启发我得出了乘幂回归和指数回归,程序如下: =[-0.352 0.223 ; -0.362 0.336 ; -0.372 0.500 ; -0.382 0.746 ; -0.392 1.112 ; -0.402 1.657 ; -0.412 2.372 ; -0.422 3.532 ; -0.432 5.256 ; -0.442 7.812]; 1=- (:,1); 2= (:,2); x=0:0.01:0.5; %线性拟合 % 2=a* 1+b [p,s]=polyfit( 1, 2,1); a=p(1) b=p(2) y=a*x+b; norm=s.normr %fig re(1) h1=s bplot(2,2,1); plot( 1, 2, * ,x,y, r ); axis([0.3 0.5 0 12]) hold on title( 线性拟合 ) %乘幂拟合 % 2=a* 1^b,log 2=b*log 1+loga [p1,s1]=polyfit(log( 1),log( 2),1); b=p1(1) a=exp(p1(2)) y=a*x.^b; norm1=s1.normr %fig re(2) h2=s bplot(2,2,2); plot( 1, 2, * ,x,y, r ); axis([0.3 0.5 0 12]) hold on title( 乘幂拟合 ) %指数拟合 % 2=a*exp(b* 1),log 2=b* 1+loga [p2,s2]=polyfit( 1,log( 2),1); b=p2(1); a=exp(p2(2)) y=a*exp(b*x); norm2=s2.normr %fig re(3) h3=s bplot(2,2,3); plot( 1, 2, * ,x,y, r ); axis([0.3 0.5 0 12]) hold on title( 指数拟合 ) 显示结果与方法一相同.