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 for Programming
 Forum for Origin C
 fitting data with complex equation

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
cellbiophysics Posted - 12/06/2007 : 9:47:56 PM
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.

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