Last Update: 7/25/2018
You can use the Labtalk function Nlbegin and Nlfit to perform nonlinear fit, and get the fitting parameter values in nonlinear fit at each iterations.
// 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;
When you enter value 8 in iteration input box when you run the script, you can get the results similar to this:
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