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
 Origin Forum
 tri-exp decay & gaussian IRF Convolution NLfit

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
tgpark1160 Posted - 01/22/2019 : 08:45:04 AM
My origin ver.:OriginPro 2019 (64-bit) 9.6.0.172 (Academic)
Operating System: Window 10

I want to fit my pump-probe data with tri-exp * Gaussian function.
but, it is quite technically difficult.

Origin tutorial material gives me a piece of useful information
but, I can't solve this problem. so I need some help about this.

So, I take a past post in origin forum 11/19/2013 from willwalt

I cannot attach the files to a post due to forum restrictions. However,
Sample Signal

-1.307 --
-1.21367 3.69763E-5
-1.107 1.39684E-5
-1.01367 -6.97628E-6
-0.907 1.60316E-5
-0.81367 -5.46441E-6
-0.707 -5.3386E-5
-0.61367 3.33695E-5
-0.507 3.26456E-5
-0.41367 -2.09288E-5
-0.32034 2.9413E-5
-0.21367 -7.87322E-5
-0.12034 -8.69414E-5
-0.01367 -4.68866E-4
0.07966 -0.00141
0.18633 -0.00273
0.27966 -0.00389
0.38633 -0.00535
0.47966 -0.00649
0.58633 -0.00752
0.66633 -0.00793
0.79966 -0.00889
0.87966 -0.00922
0.98633 -0.00979
1.07966 -0.01033
1.19966 -0.01097
1.27966 -0.01115
1.38633 -0.01176
1.47966 -0.01214
1.58633 -0.0126
1.67966 -0.01286
1.78633 -0.01301
1.98633 -0.01363
2.07966 -0.01379
2.19966 -0.01421
2.27966 -0.01428
2.38633 -0.01466
2.47966 -0.01466
2.59966 -0.01433
2.67966 -0.0143
2.79966 -0.01456
2.87966 -0.01449
2.98633 -0.01412
3.07966 -0.01404
3.18633 -0.0143
3.27966 -0.01438
3.39966 -0.01429
3.47966 -0.01448
3.58633 -0.01447
3.67966 -0.01453
3.79966 -0.0145
3.87966 -0.01445
3.98633 -0.01438
4.07966 -0.01432
4.18633 -0.01425
4.27966 -0.01418
4.38633 -0.01411
4.47966 -0.01404
4.58633 -0.01397
5.07966 -0.01349
5.58633 -0.0132
6.07966 -0.01292
6.58633 -0.01272
7.07966 -0.01259
7.58633 -0.01229
8.07966 -0.01199
8.59966 -0.01182
9.07966 -0.01163
9.58633 -0.01141
10.3863 -0.01104
11.1863 -0.01088
11.9863 -0.01054
12.7997 -0.01047
13.5863 -0.01003
14.3863 -0.00984
15.1863 -0.00938
15.9863 -0.00927
16.7997 -0.00893
17.5863 -0.00876
18.3863 -0.00861
19.1863 -0.00866
19.9863 -0.00831
20.7997 -0.00835
21.5863 -0.00829
22.3997 -0.00818
23.1863 -0.00808
23.9863 -0.00772
24.7997 -0.00751
25.5863 -0.00737
26.3997 -0.00725
27.1863 -0.00713
27.9863 -0.00711
28.7863 -0.00709
29.5863 -0.00702
30.3863 -0.0068
31.1863 -0.00663
31.9863 -0.00654
32.7863 -0.0063
33.5863 -0.00617
34.3863 -0.00612
35.1863 -0.00598
35.9863 -0.006
36.7863 -0.0058
37.5863 -0.00555
38.3863 -0.0055
39.1863 -0.00544
39.9863 -0.00525
40.7863 -0.00523
41.5863 -0.00514
42.3997 -0.00508
43.1863 -0.00498
43.9863 -0.00507
44.7863 -0.00479
45.5863 -0.00472
46.3863 -0.00481
47.1863 -0.00464
47.9863 -0.00478
48.7863 -0.00462
49.5863 -0.00455
50.3863 -0.00457
51.1863 -0.00438
51.9863 -0.00434
52.7863 -0.00422
53.5863 -0.00409
54.3863 -0.00406
55.1863 -0.00401
55.9863 -0.00404
56.7863 -0.00394
57.5863 -0.00399
58.3863 -0.00382
59.1863 -0.00379
64.1863 -0.00358
69.1863 -0.00332
74.1863 -0.00308
79.1863 -0.00288
84.1863 -0.00273
89.1863 -0.00257
94.173 -0.00251
99.1863 -0.00235
104.186 -0.00226
109.186 -0.00212
114.173 -0.00204
119.186 -0.00195
124.186 -0.00192
134.173 -0.00176
139.186 -0.00162
144.186 -0.00153
149.186 -0.00149
154.173 -0.00139
179.186 -0.00127
199.186 -0.00111
219.186 -0.00109
239.186 -9.72087E-4
259.186 -7.98242E-4
279.186 -7.61319E-4
299.186 -7.84285E-4
319.186 -6.58242E-4
339.186 -6.2044E-4
359.186 -6.2956E-4
379.186 -6.18243E-4
399.2 -5.7912E-4
419.186 -5.58242E-4
439.186 -5.20439E-4
459.2 -5.26921E-4
479.186 -4.61758E-4
499.186 -4.96923E-4
519.186 -4.31319E-4
539.186 -4.6044E-4
559.186 -4.7E-4
579.186 -4.67802E-4
599.186 -4.18681E-4
619.186 -3.88681E-4
639.186 -3.62197E-4
659.2 -4.1176E-4
679.186 -4.44725E-4
699.186 -3.25604E-4
719.186 -2.33956E-4
739.186 -3.2E-4
759.186 -3.19121E-4
779.186 -2.9956E-4
799.186 -2.92638E-4
819.186 -3.48681E-4
839.186 -3.19561E-4
859.2 -3.1E-4
879.186 -3.08681E-4
899.186 -2.83077E-4
919.186 -3.47802E-4
939.186 -3E-4
959.186 -2.98242E-4
979.186 -2.5956E-4
999.186 -2.4956E-4
1019.19 -2.43077E-4
1039.19 -3.09853E-4
1159.19 -2.89209E-4
1259.19 -2.00264E-4
1359.19 -2.3E-4
1459.19 -2.30088E-4
1559.19 -2.39824E-4
1659.19 -2.19824E-4
1759.19 -2.00264E-4
1859.19 -2.3E-4
1959.19 -2.30176E-4
2059.19 -2.4956E-4
2159.19 -1.9956E-4
2259.19 -1.49736E-4
2359.19 -1.20528E-4
2459.19 -1.80088E-4
2559.19 -1.90088E-4
2659.19 -1.99472E-4
2759.19 -1.40176E-4
2859.19 -1.60088E-4
2959.17 -1.6956E-4
3059.19 -1.19648E-4
3159.17 -8.07912E-5
3259.19 -1.69912E-4
3359.17 -1.59648E-4
3459.19 -1.2E-4
3559.17 -1.19824E-4
3659.19 -9.99121E-5
3759.17 -9.05275E-5
3859.19 -1.49472E-4
3959.17 -9.07033E-5
4059.19 -1.69472E-4
4159.19 -1.09472E-4
4259.19 -5.05276E-5
4359.17 -1.10088E-4
4459.19 -1.20176E-4
4559.17 -1.39385E-4
4659.19 -7.04397E-5
4759.17 -1.1956E-4
4859.19 -6.99121E-5
4959.17 -6.02637E-5
5059.19 -9E-5
5159.17 -9.04396E-5
5259.19 -1.39824E-4
5359.17 -1.20088E-4
5459.19 -1.29824E-4
5559.19 -1.1E-4
5659.19 -1.09824E-4
5759.17 -9.01758E-5
5859.19 -1.09912E-4
5959.17 -9.98242E-5
6059.19 -8.02638E-5
6159.17 -1.10352E-4
6259.19 -1.49736E-4
6359.17 -1.19736E-4
6459.19 -9E-5
6559.19 -9.07034E-5
6659.19 -1.68681E-4
6759.17 -2.10549E-5
6859.19 -1.39472E-4
6959.17 -8.04395E-5
7059.19 -1.29824E-4
7159.17 -1.09736E-4
7259.19 -7.95603E-5


If you highlight this data and select two columns to paste in origin this will reproduce my sampling and signal that I want to fit. The first column is X and second column is Y.

As for the code:

#pragma numlittype(push, TRUE)
#pragma numlittype(push, TRUE)
#pragma warning(error : 15618)
#include <origin.h>
// Header files need to be included
#include <ONLSF.H>
#include <fft_utils.h>

//----------------------------------------------------------
//
void _nlsffitconv3(
// Fit Parameter(s):
double y0, double A1, double t1, double A2, double t2, double A3, double t3,
// Independent Variable(s):
double x,
// Dependent Variable(s):
double& y)
{
// Beginning of editable part
// Beginning of editable part
Worksheet wks = Project.ActiveLayer();
NLFitContext *pCtxt = Project.GetNLFitContext();
if ( pCtxt )
{
// Vector for the output signal in each iteration.
static vector vSignal;
// If parameters were updated, we will recalculate the convolution result.
BOOL bIsNewParamValues = pCtxt->IsNewParamValues();
if ( bIsNewParamValues )
{
// Read sampling and response data from worksheet.
Dataset dsSampling(wks, 0);
Dataset dsResponse(wks, 2);
int iSize = dsSampling.GetSize();

vector vResponse, vSample;

vResponse = dsResponse;
vSample = dsSampling;

vSignal.SetSize(iSize);
vResponse.SetSize(iSize);
vSample.SetSize(iSize);

// Compute the exponential decay curve
vSignal = A1 * exp( -t1*vSample ) + A2 * exp( -t2*vSample ) + A3 * exp( -t3*vSample ) ;
// Perform convolution
int iRet = fft_fft_convolution(iSize, vSignal, vResponse);

}

NLSFCURRINFO stCurrInfo;
pCtxt->GetFitCurrInfo(&stCurrInfo);
// Get the data index for the iteration
int nCurrentIndex = stCurrInfo.nCurrDataIndex;
// Get the evaluated y value
y = vSignal[nCurrentIndex] + y0;
// For compile the function, since we haven't use x here.
x;
}
// End of editable part
}


Sorry for the very long message but I thought this may be the best way . As a note, the code I have written will compile without errors. Where I am not sure is that I took most of this code from the Origin help manual and added in:

// Compute the exponential decay curve
vSignal = A1 * exp( -t1*vSample ) + A2 * exp( -t2*vSample ) + A3 * exp( -t3*vSample ) ;

Along with the necessary parameters. I'm not all too familiar with the Origin C coding so I am not sure if this will yield me the correcting fitting for a gaussian convoluted with a sum of exponentials.

Thank you so much for your help! Please let me know if I need to include anything else!
1   L A T E S T    R E P L I E S    (Newest First)
yuki_wu Posted - 01/22/2019 : 9:44:00 PM
Hi,

I am sorry that I cannot understand your question. Did you want to know how to define fitting function correctly or did you have a problem when you perform fitting using the user-defined fitting function?

First, I will suggest that you can download this app to see if there is a fitting function that applies to you:
https://www.originlab.com/FileExchange/details.aspx?fid=490

If you need to define a user-defined fitting function, please try to make your question clear and send us the FDF file and opj file via tech@originlab.com.

Regards,
Yuki

OriginLab

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