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
 Origin Forum
 Help wit user defined fitting functions

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
Anne6 Posted - 04/29/2013 : 05:43:32 AM
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 !
1   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 05/03/2013 : 4:34:29 PM
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.

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