| Author |
Topic  |
|
|
Flavs
Spain
Posts |
Posted - 09/15/2006 : 1:13:04 PM
|
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
|
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 |
 |
|
|
Flavs
Spain
Posts |
Posted - 09/16/2006 : 4:26:32 PM
|
| Thanks !!! you are really helpful. |
 |
|
|
Flavs
Spain
Posts |
Posted - 09/18/2006 : 04:05:37 AM
|
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. |
 |
|
|
Mike Buess
USA
3037 Posts |
Posted - 09/18/2006 : 08:15:42 AM
|
Use nlsf.end(1) instead of nlsf.end().
Mike Buess Origin WebRing Member |
 |
|
| |
Topic  |
|