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
 automation of curve fitting
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ph7klw

Malaysia
Posts

Posted - 10/11/2007 :  02:16:06 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): Origin 7.5
Operating System: XP

I have thousands of data to be fitted. I have defined my user-denifed fuction called SED in the Origin. Now I want to do curve fitting via automation and extract the parameters in Origin.c The code is like
"#include <Origin.h>
////////////////////////////////////////////////////////////////////////////////////
void test()
{
nlsf.func$ = SED; // select SED fitting function
L0 = 1000; //initialize parameter values
tau = 1000;
beta = 0.5;
nlsf.cleanUpFitData();
nlsf.fitdata$ = b;
nlsf.iterate(20);
nlsf.xmode = 2;
nlsf.funcx$ =A;
nlsf.funccol$ = B;
nlsf.makecurve(func);
}
"
But i dont know why I get error below
C:\.....\OriginC\SED.cpp(26) :Error, Variable "SED" not declared
C:\.....\OriginC\SED.cpp(26) :Error, general compile error
C:\....\OriginC\SED.cpp(23) :Error, error(s) found in compiling function test

any recommendation is welcome

Mike Buess

USA
3037 Posts

Posted - 10/11/2007 :  07:05:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
1. You must define nlsf with using nlsf = LabTalk.NLSF.
2. Parameter names cannot be used in OriginC. Use nlsf.pn instead.
3. All strings must be quoted.
4. Values of nlsf.fitdata$|funcx$|funccol$ must be full dataset names.

void nlsf_test()
{
using nlsf = LabTalk.NLSF; // define nlsf
nlsf.func$ = "SED"; // select SED fitting function
nlsf.p1 = 1000; //initialize parameter values
nlsf.p2 = 1000;
nlsf.p3 = 0.5;
nlsf.cleanUpFitData();
nlsf.fitdata$ = "dataset name"; // full dataset name
nlsf.iterate(20);
nlsf.xmode = 2;
nlsf.funcx$ = "dataset2 name";
nlsf.funccol$ = "dataset3 name";
nlsf.makecurve("func");
}

Finally, you can use the MultiFit addon module to fit multiple curves from the same graph or worksheet or collect the parameters for multiple fits in one worksheet.

Mike Buess
Origin WebRing Member
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