4.56 FAQ-768 在非线性拟合中如何得到每次迭代的拟合参数?
Last Update: 7/15/2018
您可以使用 LabTalk 函数 Nlbegin 和 Nlfit 来执行非线性拟合,由此获得非线性拟合每次迭代的拟合参数。
// import sample data into a new book newbook; fname$=system.path.program$ + "Samples\Curve Fitting\Exponential Growth.dat"; //prepare data impASC; // Start a fitting session; nlbegin iy:=2 func:=ExpDec1 nltree:=tt; getnumber -s (Input the iterations) n; //Construct a dialog to enable user enter the iteration he want to perform double aa=0; loop (i,1,n) { nlfit $(i); //run the i-th iteration of fitting type "The parameter value in $(i) iteration"; type "y0= $(tt.y0, %4.6f)"; //output the parameter values type "A1= $(tt.A1, %4.6f)"; type "t1= $(tt.t1, %4.6f)"; if (tt.fitstatus == 100) { type "Fit converged, no more iteration will be done"; break; } } nlend;
当您在 Input the iterations 中输入 8 时,即可得到相似的结果:
The parameter value in 1 iteration y0= -0.162869 A1= 1.283508 t1= -0.998789 The parameter value in 2 iteration y0= -0.038538 A1= 1.195022 t1= -0.968684 The parameter value in 3 iteration y0= -0.038365 A1= 1.194898 t1= -0.968641 Fit converged, no more iteration will be done
Keywords:LabTalk, nonlinear fitting, iteration, fitting parameter, 非线性拟合,迭代,拟合参数