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 for Programming
 Forum for Origin C
 fitting data with complex equation
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cellbiophysics

S. Korea
Posts

Posted - 12/06/2007 :  9:47:56 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5 SR4
Operating System: Window XP Professional

I'm trying to fit the data with a function, which includes summation and integral. The fitting function is

y(x) = P1*sum(n=0 to k){F(n,P2,P3,x)+G(P4,x)*integral[H(n,P2,P3,P4,s),s=0 to x]}.

where, P1..P4 are the fitting parameters.
I'm not good at Origin C. After reading several topics in the forum, I wrote some codes for fitting. But, it took half a day to fit the data. I want to reduce the fitting time. But, I don't know what to do. I believe there is someone who help me solve this problem.
My code is as follows.

 
double dSum = 0;
int ser=nsum;
double dU = x;
double dL = 0.0;
double b = dL;
int nSteps = nint;
double db = (dU-dL)/nSteps;
double dF;
double dFF;
double dInteg = 0.0;


for(int n = 0; n < ser; n++)
{
for (int ii = 0; ii < nSteps; ii++)
{
if (ii == 0)
dF = H(n,P2,P3,P4,s);
else
dF = dFF;
b += db;
dFF = H(n,P2,P3,P4,s);
dInteg += 0.5*(dF + dFF)*db;
}

dSum += F(n,P2,P3,x)+G(P4,x)*dInteg;

}

y = P1*dSum;



Here I set the values of nsum and nint to fixed ones. For nsum=60 and nint=500, it took more than 8 hours. The number of data was ~ 500.
  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