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
 Fittiing a function involving an integral using OC

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
csuguosheng Posted - 02/23/2007 : 07:32:11 AM
Origin Version (Select Help-->About Origin): 7.0
Operating System:WinXP
Expression£ºy=integral[p1^2*(p2+x)/(p3+x)^2]dp2,from 0 to 500, where x is the independent var, y is the dependent var, p1,p3 are parameters.

I have seen posts about the similiar problem, solutions are given in http://www.originlab.com/www/support/resultstech.aspx?language=english&ID=121.
But I know only a little about scripts, so I still don't know what to do. A very easy to follow example to use LabTalk to solve the problem was given in http://www.originlab.com/forum/topic.asp?TOPIC_ID=3812. But LabTalk takes more than one hour for my fitting.
So my question is, can anyone give an similar procedure using Origin C, which is easy to follow?
Thanks!
Sheng
7   L A T E S T    R E P L I E S    (Newest First)
csuguosheng Posted - 03/06/2007 : 03:24:22 AM
Thanks zachary!
I have sent you the data.
Really appreciate your kind help!
Sheng
zachary_origin Posted - 03/05/2007 : 9:10:10 PM
Hi Sheng,

You can send the data to tech@originlab.com or zachary@originlab.com.cn with a note on this posted topic.

Zachary
OriginLab Technical Services.




Edited by - zachary_origin on 03/05/2007 9:14:31 PM
csuguosheng Posted - 03/05/2007 : 12:06:13 PM
Hello Zachary,
I tried your codes to do the fitting just now. The fitting doesn't work... it just says "Chi-sqr is not reduced.
Total 0 rounds in this session"
I don't know what's the problem.Is it possible for me to send you my data for fitting by email?
My email address is csuguosheng@yahoo.com.
Thanks!
csuguosheng Posted - 02/27/2007 : 04:08:58 AM
Thanks so much zachary. I will try the codes soon.
Sheng
zachary_origin Posted - 02/27/2007 : 03:58:32 AM

double dU = 500.0; // the upper endpoint of the interval
double dL = 0.0; // the lower endpoint of the interval
double z;
int nSteps = 100; // the integrating interval will be broken into nsteps for calculation. this will affect the fitting speed and precision.
double dz = (dU-dL)/(double)nSteps;
double dFz; // F(z);
double dFzz; // F(z+dz);
double dInteg = 0.0;
for (int ii=0; ii<nSteps; ii++)
{
if(ii==0)
dFz = exp(-z)/((P1+P2*x)*(P1+P2*x)+(z-P3*x)*(z-P3*x));
else
dFz = dFzz;
z += dz;
dFzz = exp(-z)/((P1+P2*x)*(P1+P2*x)+(z-P3*x)*(z-P3*x));
dInteg += 0.5*(dFz+dFzz)*dz;
}
y = P4*P4*dInteg/(P4*P4+x*x);



Zachary
OriginLab Technical Services.

csuguosheng Posted - 02/27/2007 : 03:17:53 AM
Thanks zachary. Actually the function I gave is not the original function I use for fitting. For the sake of easy reading I just showed an example. The function I need cannot be integrated analytically, i.e, it has to be integrated numerically.
The function is: y=(P4^2/(P4^2+x^2))*Integrate[exp(-z)/((P1+P2*x)^2+(z-P3*x)^2)]dz,z from 0 to 500,where x is the dependent parameter;y is the independent parameter; P1,P2,P3,P4 are the fitting parameters.
I can use TabTalk to do the fitting but it takes too long(more than an hour sometime).So I wonder using Origin C may shorten the running time.
Look forward to see your response!
Thanks again!
Sheng
zachary_origin Posted - 02/26/2007 : 8:50:39 PM
Hi Sheng,

When I am trying to write the OC code for the function, I find it is easy to get the symbolic integeration of the expression. So why not use the integrated result for fitting?

Zachary
OriginLab Technical Services.



Edited by - zachary_origin on 02/27/2007 04:08:01 AM

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