Author |
Topic  |
|
dybdal
Denmark
3 Posts |
Posted - 01/23/2002 : 10:49:36 AM
|
How do you type in the following equation as an Y-script for non-linear curve fitting:
y=integral(from T=a to T=b) of k * dT
|
|
Mike
USA
357 Posts |
Posted - 01/24/2002 : 09:02:50 AM
|
Hi dybdal,
You will want to look over this Knowledge Base item on Fitting with Integrals.
You should also look over the LabTalk documentation for the "Integrate" command and the "Integ" Object (pages 130 and 268 in your 6.0/6.1 Labtalk Manual or go to your online help files -- Help: LabTalk, and look in the index for "Integrate" and "Integ").
I hope this helps.
Mike OriginLab Tech Support
|
 |
|
kfauth
Germany
33 Posts |
Posted - 02/06/2002 : 06:04:48 AM
|
dybdal,
the best way to go might depend on how your integral enters in the fitting function. One point is: do you need to calculate the integral once per fitting iteration (i.e. it only depends on fitting parameters) or once per datapoint of the curve to be fitted (it depends on x (also)).
I have had a related problem (see my post from 12/11/2001). In my case the criterion related to the parameter p1 (comparison to the variable store: if(p1 != store) as given in the article Mike refers to did not work. Also, if you choose to fix this parameter and have others varied, you will have to modify your script.
Instead I use: if(nlsf.curRow==1){calculate integral once per iteration only} and this works fine with me (origin 5.0)
Kai
|
 |
|
dybdal
Denmark
3 Posts |
Posted - 02/07/2002 : 07:59:41 AM
|
Thank you Kai,
I havn't solved my problem with integrals in Y-scripts yet. Below i have listed my Y-script:
Before a fit a initialize the variables Tu, Ea and H. I have my x data in Data1_A and the y data in Data1_B.
Data1_C=exp((Ea/2)*((1/((1/(Tu+200))-Data1_A+200)))); integrate Data1_C; Data1_E=H*Data1_C*(1/1.5)*exp((-1/1.5)*(_integ_area)); Y=Data1_E(X);
If I fit data to my experimental data points I get a nice fit and the values of Ea, Tu and H are respectively: 88700, 88.2 and 585600.
When I run the script from the script window with the above mentioned values I get a very poor fit. Using the script i find that the optimal values are Ea=35000, Tu=103 and H=585600.
The values obtained using the script reflect the the "true" values.
Does anyone have an explanation or a solution?
|
 |
|
kfauth
Germany
33 Posts |
Posted - 02/12/2002 : 05:07:51 AM
|
Hi again, dybdal.
things will depend on what result of the integration you want to use.
_integ_area is a dataset containing _integ_area(x)=int(from a to x over Data1_C)
If, instead (as indicated in your first post) you want the (single) numerical value int(from a to b over Data1_C) then this value is stored in the integ object property integ.area. (it is numerically equivalent to the last element of _integ_area).
As to why it works differently from script window and NLSF I don't know. It may have to do with the way x-values are being assigned in the vector operation *(_integ_area)
Hope this helps
Kai |
 |
|
Jose
Netherlands
93 Posts |
|
|
Topic  |
|