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
 Fit Convolution

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
Piasecki Posted - 01/14/2022 : 08:25:58 AM
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System: Origin 2022-Pro Sr1 9.9.0.225 (Academic), Win 10

Concerning the Fit Convolution appl.: is it possible to add to the fitted function (e.g. Gaussian + Lorenzian) the condition of some cut off, e.g. f(x) = 0 for x < 0? Of course, this condition should not apply to the signal (resolution function), nor to the data.
25   L A T E S T    R E P L I E S    (Newest First)
Piasecki Posted - 01/19/2022 : 2:40:34 PM
Unfortunately, my attempts are not successful, the iterations finish without converging. Perhaps the initial parameter values are bad, or the function is not good.
Unfortunately, the visualization of the function with initial parameters (the red line in the figure above) is in complete disagreement with the parameters. Anybody knows why???

Eryk
Piasecki Posted - 01/18/2022 : 11:03:15 AM
For some reasons I don't see one of 2 att.https://my.originlab.com/ftp/forum_and_kbase/Images/Book47B.ogwu
Piasecki Posted - 01/18/2022 : 11:00:55 AM
Since I'm not sure whether i sent the attachments, I do it again.

Erykhttps://my.originlab.com/ftp/forum_and_kbase/Images/formulaA.txt
Piasecki Posted - 01/18/2022 : 10:55:53 AM
Yes, as always (see attachment)

Eryk
YimingChen Posted - 01/18/2022 : 10:10:35 AM
Make sure you have the response data saved in col(C). See the tutorial page.
https://www.originlab.com/doc/tutorials/fitting-convolution

James
Piasecki Posted - 01/17/2022 : 5:12:17 PM
Yes, it partly helps, at least one can see some peak (see att.), but it still doesn't react on the parameter's changes. Eg. here initial xc = 2, but on the plot it is at 12 and is there frozen....

Eryk
YimingChen Posted - 01/17/2022 : 4:34:46 PM
This is what I meant
Piasecki Posted - 01/17/2022 : 4:23:34 PM
If I understand what you have in mind, I presume that"Fitted curves" on the left panel ARE selected (see attachment), however I don't know where is the 2nd panel.

Eryk
YimingChen Posted - 01/17/2022 : 2:03:12 PM
In the NLFit dialog, you can select Fitted Curves in the left panel, and in the right panel, set X data Type to same as Input Data. See if it helps.

Otherwise, you can try different initial parameters.

James
Piasecki Posted - 01/17/2022 : 12:04:28 PM
Great. Unfortunately, I don't see any reaction of the initial distribution (in red) on the parameter setting. Should I?
I am asking this since for the moment the iterations cannot result in finding solution, probably by the improper initial parameters setting.

E.

YimingChen Posted - 01/17/2022 : 11:58:17 AM
It shouldn't matter when you set the initial values.
Piasecki Posted - 01/17/2022 : 11:27:36 AM
Should I put initial values before compilation?
YimingChen Posted - 01/17/2022 : 11:18:12 AM
Click Next button until the Finish button is enabled.
Piasecki Posted - 01/17/2022 : 11:07:14 AM
Thanks, apparently now it is compiled, but after Return to Dialog cannot click the Finish button, since it is shadowed (see attachment).

What should I do?
Eryk
YimingChen Posted - 01/17/2022 : 10:30:36 AM
Right now your func() is defined within _nlsfmyConv() function. Can you move the function before the FitConvolutionModel(ARGS2) function as I already showed in the figure?



James
Piasecki Posted - 01/17/2022 : 09:58:03 AM
I believe I did it many times.

If "add the code below the fitting function file" means: below the
CONVOLUTION( func(A, xc, w1, w2, x), h(x) )

then I did it already many times, with the same error.

If you mean anything else, please explain precisely what you mean by "defining the function func() outside _nlsfmyConv().

Thank you.
Eryk
YimingChen Posted - 01/17/2022 : 09:07:22 AM
For the compiling error, you need to define the function func() outside _nlsfmyConv(). Thanks.

James
Piasecki Posted - 01/17/2022 : 12:57:39 AM
Here is the prntscr

Piasecki Posted - 01/15/2022 : 12:19:42 PM
Hi,
Thanks a lot for your recipe!
I tried to follow it, but the compilation failed and I am unable to find the error.
I would like to send you the printscreen, but I don't know how to attach the file. Help, pls.

Best regards
Eryk
Piasecki Posted - 01/15/2022 : 05:31:15 AM
PS I cannot open the link https://my.originlab.com/ftp/forum_and_kbase/Images/myConv.FDF
Piasecki Posted - 01/15/2022 : 04:08:13 AM
Thanks a lot, but this is a different situation than in my case, as here the data are evidently cut at some X value, so you can find the appropriate fitting function f(x).
In my case, the situation is different: the cut is certainly present because of the conservation energy law, so all part of the observed distribution to the left of the cut is due to the resolution effects, thus it cannot be seen in the solution, i.e. in the fitting function.

Somehow I cannot find here the way of attaching the figure nor data. I can send them to you if you tell me how.

Eryk
YimingChen Posted - 01/14/2022 : 3:43:30 PM
To fit the data, select col(B) and go to menu Analysis->Fitting->Nonlinear Curve Fit... Pick the fitting function myConv, and run the fit.

I attached the fitting function here.

https://my.originlab.com/ftp/forum_and_kbase/Images/myConv.FDF

James
YimingChen Posted - 01/14/2022 : 3:35:25 PM
OK, here is the way to go:
1. Launch the Fit Convolution app, and make the settings as shown below and click Save as... to save the fitting function to myConv. Here we only declare the func(A, xc, w1, w2, x) and we will define it later.


2. Close the app, choose from menu Tools:Fitting function builder..., choose Edit a User-defined Function, select myConv. Keep click Next button until the Origin C Fitting Function page. Click the button to open Code Builder.



3. Add the code below to the fitting function file. Click Compile button, then click Return to Dialog.

double func(double A, double xc, double w1, double w2, double x) {
	if (x < 0) {
		return 0;
	} else {
		return  A*exp( -(4*ln(2)*(x-xc)^2)/w1^2 )*(1-Sign(x-xc))/2.0 + A*(w2^2/(4*(x-xc)^2 + w2^2))*( 1+Sign(x-xc) )/2.0;
	}
}




4. Click Finish button. Then the fitting function it built.
Piasecki Posted - 01/14/2022 : 11:57:38 AM
Thank you, but this I know.
Unfortunately, I don't know nor C language, neither LabTalk.
I know that e.g. for the Gaussian + Lorentzian the function is defined as:
f(x) = A*exp( -(4*ln(2)*(x-xc)^2)/w1^2 )*(1-Sign(x-xc))/2.0 + A*(w2^2/(4*(x-xc)^2 + w2^2))*( 1+Sign(x-xc) )/2.0

Could you please tell me how to modify this expression by introducing the cut
f(x) = 0 for x < 0 or more generally for x < xcut ?
YimingChen Posted - 01/14/2022 : 10:54:23 AM
The app only allows function expression. You may want to check this tutorial page on defining convolution function with Origin C code:
https://www.originlab.com/doc/en/Tutorials/Fitting-Convolution

James

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