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
 gauss 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

Flavs

Spain
Posts

Posted - 09/15/2006 :  1:13:04 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5
Operating System:xp sp2

Hi, I have made a script to do a gauss fit. I made it mainly coping other scripts from the forum, so maybe is not the best piece of code. But the code seems to work properly for me.

I want to change the two following things , after the code executes it creates a window with the fitting data, I want to avoid this!!! I only nead the peak of the curve an I alredy write this on a variable at the end of the code.
Second thing I want to change, I don´t want to give initial values to the parameters of the fitting, when you do a gauss fit using the origin interface (Analysis:: FitGaussian) you don´t need to specify any values, so why do I have to initialize the parameters when I execute my script. If I don´t initialize the parameters the code doesn´t work.

my script

[main]
rango1=%1; // data begin
rango2=%2; // data end
campo=%3; // field (dataset name)
tem=%4; // temperature (dataset name)

nlsf.init(); // initialize fit
nlsf.dataBegin=rango1; // begin range
nlsf.dataEnd=rango2; // end range
nlsf.func$="Gauss"; // define function to be used during fitting
nlsf.constr$=""; // clean ???
nlsf.fitData$=h$(campo)t$(tem)_re; // define data to be fitted
nlsf.funcX$=h$(campo)t$(tem)_an;// X data to be used to create fit dataset

nlsf.p1= 2; // initialize parameters
nlsf.p2=260;
nlsf.p3=30;
nlsf.p4=10;
nlsf.iterate(150); // perform 150 iterations

pico=nlsf.p2; // write xc in pico variable
nlsf.end();

Mike Buess

USA
3037 Posts

Posted - 09/15/2006 :  2:49:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
1> Insert nlsf.output(0); before nlsf.iterate(150); to avoid the graph window.

2> Analysis::FitGaussian initializes the parameters automatically. You can do the same by replacing nlsf.p1=2; nlsf.p2=260; nlsf.p3=30; nlsf.p4=10; with nlsf.execute("paranint");.

Mike Buess
Origin WebRing Member
Go to Top of Page

Flavs

Spain
Posts

Posted - 09/16/2006 :  4:26:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks !!! you are really helpful.
Go to Top of Page

Flavs

Spain
Posts

Posted - 09/18/2006 :  04:05:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, It´s me again, everything works fine. But I want to modify a detail, I don´t want the plot of the curve fitting in my graph, how do I change this detail?.

Thanks.
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 09/18/2006 :  08:15:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Use nlsf.end(1) instead of nlsf.end().

Mike Buess
Origin WebRing Member
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