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
 Help wit user defined fitting functions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Anne6

Belgium
1 Posts

Posted - 04/29/2013 :  05:43:32 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8
Operating System: windows 7

Hello everyone,

I'm not familiar with the user defined fitting functions in Origin 8 and I a trying to implement one but don't succeed so far..

Here is the function :
independent variable : x
dependent variable : y
parameters names : as,ar,b,f,a,c

loop(int n,0,c-1){f = f + ((a*x)^n * exp(-a*x))/n!);};
y = f*exp(-as*x) + (1,0-f)*exp(-ar*x - b*x^2);

I selected Origin C as function form. If I try to compile, I get an error message telling that something is not declared inside the loop.
What should I do to get it work ?

Thanks a lot !

greg

USA
1378 Posts

Posted - 05/03/2013 :  4:34:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
loop is not found in Origin C and neither is factorial (n!)
Try this

for(int n = 0 ; n <= c-1 ; n++)
{
val = n;
for( factorial = 1 ; val > 1 ; val -- ) factorial *= val;
f = f + ((a*x)^n * exp(-a*x))/factorial);
}
y = f*exp(-as*x) + (1,0-f)*exp(-ar*x - b*x^2);

Note that c must be an integer less than 171.

Edited by - greg on 05/03/2013 4:37:28 PM
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