The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 NLSF initialize
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

fabian-rol

France
Posts

Posted - 04/29/2005 :  04:41:54 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I'm trying to fit an “ExpDecay2” curve, and I try to manually set the parameter values in my code, such as:
nlsf.p1=somevalue;
nlsf.p2=somevalue;
But, when the fit begins, the nlsf.pn values are auto initialized with wrong parameters so that the fit doesn’t converge (NLSF.fit(0) to test nlsf.pn values).
How can I choose the initialisation by myself ?

part of the program

void fit2exp (string strCurve)
{
using NLSF = LabTalk.NLSF; // Point to the NLSF object
NLSF.Init(); // Initialize the fitter
NLSF.Func$ = "ExpDecay2"; // Assign fitting function
NLSF.Cleanupfitdata(); // Begin fitting session
NLSF.fitdata$ = "e749bg2_B"; // fit first dataset in layer
NLSF.xmode = 4;
NLSF.funcx$ = "e749bg2_C"; // use as X dataset

NLSF.xBegin = 170; // set up x values
NLSF.xEnd = 820;
NLSF.xPoints = (NLSF.xEnd)-(NLSF.xBegin);

NLSF.p1 = 0; // y0 of first dataset
NLSF.p2 = 168.8; // x0 of first dataset
NLSF.v2 = 0; // x0 is fixed
NLSF.p3 = 972.4; // A1 of first dataset
NLSF.p4 = 33.2; // t1 of first dataset
NLSF.p5 = 197.3; // A2 of first dataset
NLSF.p6 = 358.5; // t2 of first dataset

NLSF.fit(0); // iterate 100 times

// when I test here the values of NLSF.p2 it is : 1 !!!

NLSF.End();


}


I'm grateful for any comment
Thanks a lot!!

easwar

USA
1965 Posts

Posted - 04/29/2005 :  11:09:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

How are you examining the values? Are you bringing up the dialog? If you bring up the NLSF tool, then it shows the fit page, but in the background it runs the parameter initialization code. This can be changed by going to the Script->Parameter Initialization page and unchecking the "Enable Automatic Parameter Initialiation" check box and then saving the function.

If on the other hand you programmatically examine the values, such as go to script window and type
nlsf.p1=
it should show the values you had set.

Easwar
OriginLab

Go to Top of Page

fabian-rol

France
Posts

Posted - 05/02/2005 :  03:50:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much, it is working well, now
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000