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
 masking data for nlsf fitting
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ChristianB

Germany
2 Posts

Posted - 03/11/2009 :  1:39:56 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): v7.0552 (B552)
Operating System:Windows XP

Hello.
I've got the following problem. I have got a dataset with a spectrum in each column. You can see the plot of one example spectrum in the graph "BeforeFitting" in the picture at the bottom.
I want to create a dataset, which only contains the dips, that you can see in the spectrum. Therefore i use a nonlinear least square fitting script, which you can see in the scriptwindow.
This works fine, without the lines

window -a DATA;                           //
worksheet -s 1 45 500 175;         // selektiert Range 
mark -w1 DATA;                      // maskiert Range


Which means i use the whole dataset for the gauss fit.

So far so good. But my data are not precise enough, because i include the data of those dips for the fit. This is, where those quoted lines come in. I use them to mask the range around those dips, so they are not used for the fit. But it seems like it works diffrent than when i manually use the gaussian fit from the "analysis" menu for a column with masked data. Because, if i use it manually for a column, it simply ignores those data for the fit, but the curve of the fit expands over the whole area, including the masked ones. In my script though, it seems as if this area is completely deleted. To illustrate this i have ploted the fitting data of the last fit in the graph "FITplot", where you can see the gap. As a result i can't create the dataset, that should show the dips.

So, what do i do wrong? Is there a problem in my script? How can i fix it? I simply want to mask those peaks for the fit...


ChristianB

Germany
2 Posts

Posted - 03/11/2009 :  1:46:22 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I thought i'd better add the code of the fitting script in written form too, not just the picture....



DATA!wks.col(C1);
DATA!wks.insert(A);
worksheet -t $(1) 4;
col(A)=data(1,end-start+1,1);


window -n data FIT;  
FIT!wks.addcol(A);
worksheet -t $(1) 4;
FIT!wks.addcol(B);
col(A)=data(1,end-start+1,1);


for(j=1;j<=all;j+=1) {


nlsf.func$ = GaussAmp; 
//y0=0;
//xc=10;
//w=200;
//A=1;
nlsf.cleanupfitdata();
nlsf.fitdata$ = DATA_C$(j); 
nlsf.iterate(100); 
nlsf.funcx$ = DATA_A; //use as X dataset
nlsf.xmode = 2; 
nlsf.funccol$ = FIT_B;  //Store fitted y data
nlsf.makecurve(func);    //dataset generated for the fitted curve

DATA_C$(j)-=FIT_B;

};

window -cd;
delete DATA_A;
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