Author |
Topic |
|
Anne6
Belgium
1 Posts |
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 !
|
|
greg
USA
1378 Posts |
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. |
Edited by - greg on 05/03/2013 4:37:28 PM |
|
|
|
Topic |
|
|
|