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 a peak with two Gaussians

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
MaryWd Posted - 11/14/2011 : 08:45:35 AM
Hi! I want to fit a peak in an XRF spectrum with 2 Gaussian functions. I'm using Analysis/Fitting/Fit Multi-peaks but the result is not good. I want to specify exactly the position of the peaks and maybe fix their widths. What should I do?
Thank you
Maria
13   L A T E S T    R E P L I E S    (Newest First)
XZ_laser Posted - 06/27/2013 : 09:54:59 AM
I found the problem that's been giving me trouble. The Origin I am using is 8.0.xxx (old license on the company computer), and the syntax is a bit different for calling built-in function. There is also a weird need to enter in the variable and the parameters that was called in the function box. I learned this in an example in an article in the Origin Wiki.

Sam,

Thanks for your suggestions as well.
Sam Fang Posted - 06/27/2013 : 04:31:44 AM
You can notice the comment in the Function box for Voigt function.
quote:
Please note that the expression is not Origin C code, and Origin C code is:


And you should use:
y = nlf_voigt(x,y0,xc,A,wG,wL);


If the relative spacing xk is a fixed constant, as Easwar suggested, you can define the constant in Script Window, e.g. xk=3.2. Then in Peak Analyzer, you can add constraints as follows:

xc__2-xc__1=(b-a)*xk;
xc__3-xc__1=(c-a)*xk;


If the relative spacing xk is also a parameter to be fitted, i.e. an unknown value, you can define constraints in Peak Analyzer:

(xc__2-xc__1)/(b-a)=(xc__3-xc__1)/(c-a);


Sam
OriginLab Technical Services
XZ_laser Posted - 06/27/2013 : 03:25:48 AM
easwar,

Thanks for the suggestion. I will try that.

Regarding the NLFit: Manually defining a function consisting of sums of explicitly written Gaussian functions with xc and xk as fitting parameters works for my application. However, I can't seem to make this work with explicitly written out Voigt functions (which I copy and pasted from the built-in Voigt function in the Fitting Function Organizer, with the integrals and all). Is there a way to call out the built-in Voigt (not writing it out) when writing a custom fitting function?
easwar Posted - 06/26/2013 : 1:30:25 PM
Hi XZ_laser,

So the issue is that you need to use a variable/parameter named xk, to scale the spacing, but there is no place to define and use such a parameter/variable, inside of the NLFit or PA gui....the constraint code box does not allow defining a variable with a value.

One "clumsy" workaround is to open script window and type:
xk=3.2
and press enter, thereby defining a global variable xk with value 3.2

Then in the constraint code, you can use this variable, and the value will be carried thru. Then with PA still open, you can even go to script window and change the variable value, and then go back to PA and do more iterations (you may need to change some parameter inside PA to make the iteration buttons available again).

We will look into what is a better way to support this in future version, thank you for bringing this up.

Easwar
OriginLab
XZ_laser Posted - 06/26/2013 : 11:51:33 AM
I am trying to fit a particular curve with 3 very closely spaced Gaussian curves of equal width. The relative spacing of the curves are fixed (peak centers are at xc+a*xk, xc+b*xk, xc+c*xk, where a, b, and c are real numbers and not fitting parameters). The relative amplitudes between the peaks are defined before hand as well. I need help in figuring out how to do this with OriginPro.

1) Peak Analyzer is a very nice tool for peak fitting. I figured out how to use constraints to fix the relative amplitudes between the Gaussians. Unfortunately, I don't know how to fix the relative spacing between the Gaussian peak centers as this requires fitting for an additional parameter. Is there a way to do this with peak analyzer?

2) Using nonlinear fitting with the built-in Gaussian function and using replicas is also easy to use, but I run into the same problem of needing an additional parameter and defining the relative spacing between the peak centers.

3) Defining a new function seems to be the best way. The first method I tried is to make a Y-script function, and manually type out each three Gaussian curves and their relative distances with respect to each other. This method works, but it's cumbersome--it's extremely slow compared to the previous two methods.

The second method I want to try is to call the built-in Gaussian function, and insert an additional parameter into the peak centers. How do I do this? Do I need to use something other than Y-script?

In the future, I might want to fit with Voigt functions. Is copying and pasting the built-in Voigt functions possible? If not, then I will need to call the built-in Voigt functions by name. How will they be called?
malgoska Posted - 06/26/2013 : 07:45:22 AM
If you're using the Pro version, then use peak analyzer tool, perform fitting on single column and save it as a theme. After that you can use it to perform batch peak analysis on several columns.
If you don't have OriginPro, then you can create your own nonlinear fitting function quoting the built-in gaussians and perform fit on multiple columns.
Nikodem87 Posted - 06/26/2013 : 07:32:09 AM
Hi everyone!

I want to fit two gausses to multiple columns. When I have tried fitting a replicated gauss to a single column everything was OK - i just set 2 in the Settings->Advanced->Replica menu, but the Replica menu is disabled when I try do a multiple column fit. Why is that so? Is there any way to use this method for multiple columns?
MaryWd Posted - 11/17/2011 : 5:55:25 PM
Hi Hideo,
I didn't do any upgrades because I was working fine with this version. I'll try it. Thank you for helping.
Maria
Hideo Fujii Posted - 11/17/2011 : 5:12:42 PM
Hi Maria,

You're using the earliest release (Sr0) of Origin 8.0, and probably that is the reason why you couldn't find the Fit Peaks option in the Peak Analyzer. So, I suggest you to upgrade top the later Service Release (SR) - the latest one is SR6 - by choosing "Help: Check for Updates" menu. If you have any difficulties to upgrade to the later SR, please contact to our technical support line.

--Hideo Fujii
OriginLab
MaryWd Posted - 11/17/2011 : 4:43:25 PM
Hi Hideo,
I'm using Origin Pro 8 v 8.0724
Hideo Fujii Posted - 11/17/2011 : 4:16:40 PM
Hi Maria,

> I'm using OriginPro however the peaks and Baseline menu only gives me the Find Peak option which gives the center of the peak.

Which version and service release number ("Help: About Origin" menu) are you using? In the Peak Analyzer of OriginPro 8.x, you should be able to find "Fit Peaks" goal in addition to "Find Peaks" and other goals in the first page of this wizard-type tool.

--Hideo Fujii
OriginLab
MaryWd Posted - 11/17/2011 : 3:29:48 PM
Hi Hideo, thank you for the reply.
The replica setting was what I was looking for.
I'm using OriginPro however the peaks and Baseline menu only gives me the Find Peak option which gives the center of the peak.
Maria
Hideo Fujii Posted - 11/16/2011 : 2:38:13 PM

Hi Maria,

For such finer control of fitting, I suggest you to use the general non-linear curve fitter (NLFit) with the Replica setting (Settings tab> Advanced). In this mode of setting, you can turn ON the "Fixed" check boxes of the parameter of peak centers(xc) or width(w), and give the specific values of your choice.

In addition, if you are using OriginPro version, you can use Peak Fitting feature in Peak Analyzer (Analysis> Peaks&Baseline> Peak Analyzer menu), which is easy to use by Wizard type of interface as designed for peak/spectrum fitting.

Hope this suggestion is helpful.

--Hideo Fujii
OriginLab

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