Hi,
I presume you want to fit to a different section of the data each time. You can do this by programming the LabTalk nlsf object. You can then use the mks1 and mks2 system variables to set data markers to select various subsets of our data and fit each subset using a loop.
A crude example is pasted below. You could look in LabTalk help files for details and then refine the example as needed.
Before you run code (such as this), I suggest you first define/create a new fitting function and then save that function (in the example below, I call it MyFunc). You can then load your special function from the code such as below and then fit with it.
To try this code, first create your function, then graph your data, then copy and paste all lines of the code to the Script window, select/highlight all the lines, and press Enter key to execute.
Easwar
OriginLab
// Get length of active dataset
limit %c;
// Number of groups =length / 10
numgroup = (limit.size) / 10;
// Initialize NLSf object
nlsf.init();
// Assign function
nlsf.func$="myfunc";
// Point to active dataset
nlsf.fitdata$=%c;
// Loop over each group of points in active dataset
for(i = 1; i <= numgroup; i++)
{
// Use mks1, mks2 to set data markers
mks1 = 1 + (i - 1) * 10;
mks2 = i * 10;
// Give some initial value to parameters
// Can be replaced with more elaborate initialization code
nlsf.p1=1;
nlsf.p2=0.1;
// Iterate
nlsf.iterate(100);
// Report to script window
type Data Fitted from $(mks1) to $(mks2);
type Param1: $(nlsf.p1) +/- $(nlsf.e1);
type Param2: $(nlsf.p2) +/- $(nlsf.e2);
type Reduced ChiSqr: $(nlsf.chisqr);
type "";
}