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
 Origin Forum
 Problem with stretched-exponential function (Fit)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

mej

Albania
Posts

Posted - 12/01/2004 :  09:46:44 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 6.1 Pro
Operating System: win 2000

Hi everybody,

i try to fit non-exponential decay time curves with strectched-exponential function (P1*exp[(x/P2)^P3]). The problem is that the fit procedure is very slow (the iterations take a lot of time).

Thanks

Edited by - mej on 12/01/2004 09:47:37 AM

easwar

USA
1965 Posts

Posted - 12/01/2004 :  11:27:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

In versions prior to 7, you can create an external DLL and call that from your fitting function to speed things up.

In versions 7.0 and higher, you can define your function using Origin C which will be faster than LabTalk script for fitting.

Easwar
OriginLab

Go to Top of Page

mej

Albania
Posts

Posted - 12/03/2004 :  09:22:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Easwar

Do you know if there are examples to define my function using Origin C.

Mej

Go to Top of Page

easwar

USA
1965 Posts

Posted - 12/03/2004 :  10:21:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mej,

You can try this in the demo version of 7.5 that you can download from our website.

The NLSF tool will pretty much look the same. On the function definiton page, there is now a new option - the default is that the function is defined using Origin C code. Origin C is ANSI C compatible and so basically this just means you can write multiple lines of code to define your function, such as:
double temp = P1 * x;
y = temp + P2;
etc

There is a button to click that opens the code in a color-coded editor window, which then allows for easy editing/defining of the function.

For simple one-line functions, this works exactly like the script definition, except that the fitting will be faster.

A couple of things to note when defining functions with Origin C:
1> if you want to compute any temporary quantities in your function, you need to define the temporary variables, so need to write as
double temp = P1 * x;
and not just
temp = P1 * x
as in LabTalk
2> when doing math operations, need to follow C syntax
1/2 is not same as 1.0/2
1/2 will give 0, whereas 1.0/2 will be 0.5 etc
which is different from LabTalk

In the demo, there is a sample file:
\Samples\Analysis\Curve Fitting\NLSF User Def Func
that you could look at, as well.

Easwar
OriginLab


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