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 - vn and pn in OriginC
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Volker

Germany
1 Posts

Posted - 06/25/2002 :  02:46:39 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,
is there any possibility to set or read the nlsf.vn and nlsf.pn parameters from within OriginC? I tried to change them by using _LT_Obj, but it won't change anything. Also, control.Par[n] won't work either. I have to set the initial values for my (user-defined) fitfunc, and set some parameters fixed in the beginning, and make them variable after some Iterations to have good initial values.

easwar

USA
1965 Posts

Posted - 06/25/2002 :  09:15:46 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

As long as you follow the proper LabTalk syntax, the commands should work fine inside the _LT_Obj block in Origin C.

Try the following for example:

void fit(string strDataName)
{
_LT_Obj
{
NLSF.INIT;
NLSF.FUNC$ = "gauss";
NLSF.FITDATA$ = strDataName;
NLSF.P1 = 10;
NLSF.P2 = 20;
NLSF.P3 = 4;
NLSF.P4 = 90;
NLSF.V2 = 0; // fix 2nd parameter
NLSF.CONTROL("FIT"); // bring up dialog with fit page
}
}

Here, the parameter values for the "gauss" function are set, the second parameter is set as fixed, and then the NLSF dialog with the fit page is brought up.

To test the above code, open a new worksheet, fill colA with row numbers, set colB values with the formula:
gauss(col(a),10,20,5,100)+ran()
Make a plot of colB, and then type the following in the script window and hit return:
fit %c

Note that you can also have code like:

int ii = 2;
NLSF.P$(ii) = 20;

Easwar
OriginLab.


Edited by - easwar on 06/25/2002 09:23:23
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