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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 retrieving fitting parameters after nlsf-sigmaplot

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
deomlew Posted - 11/09/2006 : 12:34:26 PM
Origin Version (Select Help-->About Origin): 7.0
Operating System:windowsxp

Hello,

I've just started for the first time trying to write a small script in origin c to plot my data. I simple use the origin programming sample Automation.c

In the original file a gaussian fit is performed, for my data I need a sigmaplot instead. Performing this fit and plotting it in the data-graph works fine, but I somehow cannot get the resulting parameter values. I would like to get the A1, A2 and x0 out of it. This is part of the programm that I'm using:

//Perform nonlinear fit to plotted data
NLSFCntrl nlsfMyFit; // create NLSFcntrl - see OC_Types.h for details
initNLSF(nlsfMyFit); // initialize structure with default initial values
nlsfMyFit.pasteToPlot = false; // turn off pasting results to graph after fitting
lstrcpy(nlsfMyFit.szYdataName, strYDataName); // assign fit dataset name
lstrcpy(nlsfMyFit.szFuncName, "boltzmann"); // assign fitting function name, see fitting assistent in origin
fitNLSF(nlsfMyFit); // perform fit

//Write fit parameters to graph text labels
string strJLimMin, strJLimMax, strSym;
strJLimMin.Format("%f",nlsfMyFit.Par[1]);
strJLimMax.Format("%f",nlsfMyFit.Par[2]);
strSym.Format("%f",nlsfMyFit.Par[3]);

Thanks in advance!
3   L A T E S T    R E P L I E S    (Newest First)
deomlew Posted - 11/13/2006 : 04:45:47 AM
tnx, now it works fine!
easwar Posted - 11/09/2006 : 1:57:50 PM
Hi deomlew,

Looks like the version you have may be 7.0SR0. So first I would recommend that you get a free patch (service release) for your installation to bring it up to 7.0SR4, from our downloads area:
http://www.originlab.com/index.aspx?s=12

Once you have patched to 7SR4, you can then directly address the LabTalk NLSF object in your Origin C code such as:
using nlsf = LabTalk.nlsf;
nlsf.func$="boltzmann";
...
...
nlsf.iterate(100);
...
then you can access fit values with statements such as
double A1 = nlsf.p1;
double A2 = nlsf.p2;
etc

For a complete list of nlsf object properties, please see the LabTalk Language Reference manual.

Easwar
OriginLab



Mike Buess Posted - 11/09/2006 : 1:53:48 PM
NLSFCntrl has been replaced by a method which uses LabTalk's NLSF object directly. I strongly recommend that you update to 7.0SR4 and consult the updated Automation.c. Your code will look something like this when written for NLSF...

using nlsf = LabTalk.nlsf;
nlsf.Init();
nlsf.PasteToPlot = 0;
nlsf.Func$ = "boltzmann";
nlsf.FitData$ = strYDataName;
nlsf.Execute("parainit"); // estimate parameters
nlsf.Fit(100);

string strJLimMin, strJLimMax, strSym;
strJLimMin.Format("%f",nlsf.p1); // first parameter (A1 = nlsf.p1)
strJLimMax.Format("%f",nlsf.p2); // second parameter (A2 = nlsf.p2)
strSym.Format("%f",nlsf.p3); // third parameter (x0 = nlsf.p3)

Mike Buess
Origin WebRing Member

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000