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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Gaussian fit
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

chunkwan

Hong Kong
2 Posts

Posted - 06/27/2011 :  08:34:17 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I am trying to do a gaussian fit on my graph but I don't really know how to do it in terms of labtalk code. I am trying to cut my graph into few sections and do a fit on each section, like x value of 1-10,11-20. What are the codes for Gaussian fit if I want to cut it into few sections? And can someone explain it to me? Thanks.

Kwan

Penn

China
644 Posts

Posted - 06/28/2011 :  01:58:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Kwan,

You can use the nlbegin, nlfit, and nlend X-Functions to do that. However, when you specify the fitting data range, you need to use the data index, but not the X values. The following is a simple example:

fname$=system.path.program$ + "Samples\Curve Fitting\Multiple Peaks.dat"; // prepare data
newbook;  // create a new workbook
impasc;  // import the data
plotxy (1, 2);  // plot column b
range rr = layer1!plot(1);  // get plot 1
for(ii=1; ii<=90; ii+=30)
{
	nlbegin iy:=rr[ii:ii+30] func:=gauss nltree:=ParamTree;  // begin fitting, data index from ii to ii+30
	nlfit;  // fitting
	type Baseline y0 is $(ParamTree.y0),;   // type the fitted parameters
	type Peak Center is $(ParamTree.xc), and; 
	type Peak width (FWHM) is $(ParamTree.w);
	nlend;  // end fitting
}

You can refer to this page for more details on fitting by using LabTalk. And more examples are here.

By the way, you can use the Quick Fit Gadget to fit part of your data in the graph easily.

Penn

Edited by - Penn on 07/01/2011 04:49:33 AM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000