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 to double integral and summation
 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 - 02/20/2008 :  12:55:07 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): Origin 8.0
Operating System: Window XP

I am new in Origin 8. I would like to fit the data to a nonlinear function including the summation and double integral. Please help me to fit. My fitting function is given by



,where t is an independent variable and y is variable, and p1, p2 are parameters. And all the functions of F, G, H include "n". What I will try is to use trapezoidal rule with three "for" loops. But, I'm afraid it takes too much long time.
If you also have a good idea using Origin 7.5, please let me know.

Thanks

KB.

Edited by - cellbiophysics on 02/20/2008 02:48:49 AM

larry_lan

China
Posts

Posted - 02/21/2008 :  04:43:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This function is so complicated, I have no better idea. Instead of writing code to implement the trapezoidal rule, may be you can use the ocmath_integrate function to calculate the integrated results, .

For example, this code will integrate the function



void test()
{
// Integral steps
int nSize = 101;
// Vector to save the x, y value of the curve
vector vx(nSize);
vector vy(nSize);
// Vector to save the cumulative integral results
vector vInteg(nSize);

// Construct the X value of the curve
vx[0] = -1.0;
for(int i = 1; i < nSize; i++)
{
vx[i] = vx[i-1] + 0.02;
}
// Construct the Y value of the curve
vy = exp(vx);

IntegrationResult result;
// Perform integration using trapezoidal method.
int nRet = ocmath_integrate(vx, vy, 0, nSize-1, &result, vInteg);

double px = 0;
double py;
// Get the cumulative result at X=0
int iRet = ocmath_interpolate(&px, &py, 1, vx, vInteg, nSize);
}


Thanks
Larry
OriginLab Technical Services

Edited by - larry_lan on 02/24/2008 01:17:15 AM
Go to Top of Page

cellbiophysics

S. Korea
Posts

Posted - 02/21/2008 :  9:34:30 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for your idea.
But, I don't understand exactly your code. If your code can make a fitting time shorter, it's better. I don't know how to use your code to aapply to the double integral. Please add a comment into your code or please explain in detail.
Thanks again.

KB

PS. I would like to use the dataset to fit the data in the graph window. I don't know which one is x-axis in your code. What should I modify in your code to get the double integral in NLSF window? Please let me know.


Edited by - cellbiophysics on 02/21/2008 11:06:52 PM
Go to Top of Page

larry_lan

China
Posts

Posted - 02/24/2008 :  01:20:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi:

Sorry, I have added the comments. However, there is no function to perform multidimensional integrals in Origin, you should write codes by yourself. May be this link can help.

Thanks
Larry
OriginLab Technical Services
Go to Top of Page

cellbiophysics

S. Korea
Posts

Posted - 02/26/2008 :  11:49:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you, Larry.
I already considered some functions in Numerical Recipes in C.
I think "qromberg" is better than "qgauss" in my case.
I'm not sure which one is better. I'll try both of them.
Thanks again!

KB.
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