Author |
Topic  |
|
modelocking
Posts |
Posted - 04/29/2007 : 11:17:45 AM
|
Origin Version (Select Help-->About Origin):7.0 Operating System:Win XP
Hi guys! I need to fit experimental data with a convolution of gaussian and exponential decay. I tried to follow instrunction found in this forum and wrote what fallows:
static double Bstore, Cstore; //static property retains the parameter values over iterations BOOL bErr; Dataset dsX("Data1_A"); Dataset dsE("Data1_E"); Dataset dsInteg("Data1_F"); if(B!=Bstore || C!=Cstore) { //parameter checking dsE = (C*(exp(-0.5*((dsX-15)/4)^2))*exp((-x+dsX)/B)); //vector notation Curve W( "Data1_A", "Data1_E" ); IntegrationResult ir; bErr = Curve_integrate(&W, &ir, NULL, &dsInteg, TRUE ); // Perform integration Bstore=B; Cstore=C } y = Data_table(x, &dsInteg, &dsX);
This function compiles succesfully, but curve fitting doesn't work! Any good idea? Thanks
Edited by - modelocking on 04/29/2007 12:38:37 PM |
|
Deanna
China
Posts |
|
modelocking
Posts |
Posted - 04/30/2007 : 02:58:16 AM
|
Yes, I wrote the function fallowing that example. I don't think the problem is parameters initialization: C and B have physical meanings, so I know their values a priori. Anyway I try to initialize with many several values, but it always appears the message that the function is not generating values.I'm working on Y-Script. Maybe the problem is that independent variable x and integrating variable dsX works on the same data column? Thanks
|
 |
|
larry_lan
China
Posts |
Posted - 04/30/2007 : 04:11:35 AM
|
Maybe you can provide your data and initial values to tech@originlab.com ?
Larry OriginLab Technical Services
Edited by - larry_lan on 04/30/2007 04:12:01 AM |
 |
|
Deanna
China
Posts |
Posted - 04/30/2007 : 04:22:42 AM
|
My data is in Column A and B of the Data1 workbook. And the example works fine for me.
Deanna OriginLab Technical Services |
 |
|
Mike Buess
USA
3037 Posts |
Posted - 04/30/2007 : 09:21:14 AM
|
quote: I'm working on Y-Script.
I'm pretty sure you should use Equations when you fit with OriginC. In fact, you don't even see that option unless the Use Origin C option is unchecked. Select Form = Equations and then check the Use Origin C option.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 04/30/2007 09:26:30 AM |
 |
|
modelocking
Posts |
Posted - 04/30/2007 : 1:06:51 PM
|
Thanks Mike but you're wrong. When "compile before use" is checked both Y-Script and Equation are interpreted in Origin C......I read it on the help... Anyway.... I made a little algebra on the convolution, added a new data column for the integration variable and now it seems to work well... I will let you Know. Thank a lot everybody!!!! |
 |
|
|
Topic  |
|