Origin Version (Select Help-->About Origin): 7.5 Operating System: XP
Hello:
I want to perform 2d gaussian fitting using my own function on a series of datasets (up to 20) and have written (actually corrupted an example script) a test script to automate this tast, starting with only 2 datasets (data1 and data2). Everything seems to work OK except that the 2nd independent variable doesn't get specified- I was using nlsf.setIndep to do this, but it doesn't seem to work? Can this method be used to specify >1 independent variable in a dataset?
I suspect I could speed up this task by writing code in Origin C, but my programming skill falls a little short of that at the moment.....thanks.
The script I'm trying is:
// Set up the fit //
nlsf.func$ = gaussian2doffset; // select fitting function
nlsf.numfitsets = 2; // indicate 2 datasets to be fitted
nlsf.numDepend = 1; nlsf.numIndep = 2;
nlsf.fitdata1$ = data1_c; // define 1st dataset to be fitted
nlsf.setDepend(z(1),data1_c); nlsf.setIndep(x(1),data1_a); nlsf.setIndep(y(1),data1_b);
nlsf.fitdata2$ = data2_c; // define 2nd dataset to be fitted
nlsf.setDepend(z(2),data2_c); nlsf.setIndep(x(2),data2_a); nlsf.setIndep(y(2),data2_b);
// Initialize parameter set for data1 //
nlsf.p1 = 100; nlsf.p2 = 5; nlsf.p3 = 0.2; nlsf.p4 = 5; nlsf.p5 = 0.2; nlsf.p6 = 10;
// Initialize parameter set for data2 //
nlsf.p7 = 100; nlsf.p8 = 5; nlsf.p9 = 0.2; nlsf.p10 = 5; nlsf.p11 = 0.2; nlsf.p12 = 10;
// Perform the fit //
nlsf.fit(1); // iterate 1 time |