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
 Fitting with an integral under Origin 6.1
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

remi39

2 Posts

Posted - 02/01/2010 :  1:14:35 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release: Origin 6.1 v6.1052(B232)
Operating System: windows XP

Hi all,

I have measurment data that I would like to fit with the following function (hope the upload of the .gif works):


May it possible to do this on my version of origin, that mean to create a fit function which includes a sum and an integral.

For the moment I wrote the following program on the "Non Linear Curve Fittin" dialog box:

// Fit Parameter(s):
tu, tb, tD,
// Independent Variable(s):
t
// Dependent Variable(s):
G

int ninf=10;
int nbpas=100;
double Somme=0.0;
for (int n = 0; n < ninf; n ++)
{
int n=100;
double s=0.0;
double dF=0.0;
double dFn=0.0;
double dIntegral=0.0;

for ( int ii = 0 ; ii < nbpas ; ii ++)
{
s=t*ii/nbpas;
dF=exp(-(t-s)/tb-s/tu)/(1+s/tD);
dFn=(2*n+s/tb+(t-s)/tu)*(s*(t-s)/(tu*tb))^(n-1);
dIntegral += dF*dFn*t/nbpas;
}
int jj=1;
double Fact=1;
while (jj < (n-1))
{
Fact=Fact*jj;
jj ++;
}
Somme += dIntegral*1/(Fact^2*n);
}

G=(tb*exp(-t/tb)/(tu+tb)+tu/(tu+tb)*exp(-t/tu)/(1+t/tD)+1/(tu+tb)*Somme);

The problem is that I have the error : "the fiiting function is mot generating value" anbd I don't understand why.

So could some one help me to implement this function under a Origin version 6.1.

Thanks in advance,
Kind regards,
Rmi

greg

USA
1378 Posts

Posted - 02/01/2010 :  2:23:49 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The first problem is that Origin 6.1 did not have OriginC so there are no datatypes - everything is double.

The next problem would be your use of 'n'. It's being used to control a loop:
for (int n = 0; n < ninf; n ++)
and within that loop you are assigning a different initial value and using n throughout the remainder of the function. I cannot tell which n you mean to be using in the body of your function, but if n has the value zero then Somme will be missing value since you are dividing by zero.
Go to Top of Page

remi39

2 Posts

Posted - 02/02/2010 :  04:00:23 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you for your answer.

Indeed, there are somme errors in my code that I have corrected thanks to your comments.


Concerning the fact that Origin 6.1 did not have OriginC, can I still use this kind of program to define a new function of fit that includes an integral.
Moreover, as there is no datatype with Origin 6.1, should I define all the variables and how I have to do that?
Because I tried again my program after having corrected it but I still have the same error "the fiiting function is mot generating value" and I would like to know if I really can use this code syntax with my version of Origin.

Thank in advance,
Rmi
Go to Top of Page

greg

USA
1378 Posts

Posted - 02/18/2010 :  3:22:21 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
All numeric values in Origin 6.1 are of type double and are never declared. They are also global in scope and you do not have Origin 8.x ability to declare new scope with another variable of the same name.
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