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 for Programming
 LabTalk Forum
 fitting in a loop

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
vassilios_1 Posted - 07/23/2004 : 05:17:03 AM
Hi everybody,

I'm trying to fit a lot of Gauss curves each plotted in a separate window using a loop:
loop(i,1,150)
{
nlsf.cleanupfitdata();
win -a Peak$(i); #activate window Peak1,...
nlsf.func$ = gauss; #fit function
nlsf.fitdata$ = %C; #active dataset
nlsf.xBegin = 19.5;
nlsf.xEnd = 21.5;
nlsf.fit(10);
}
Sometimes Origin does the fitting well, sometimes it draws just a constant value or some ill-shaped curve. Why is Origin so unreliable?
If I use other fit functions like Lorentz or Voigt sometimes very stupid comments appear: "Try keeping "xc" constant". How now?

I'm tired struggling with Origin.

I'm grateful for any comment or even a better working code.
Thanks a lot!!





1   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 07/23/2004 : 10:25:17 AM
Hi,

I think you are encountering problems because there is no parameter initialization being done in your code. Thus the starting parameter values may be set to some default such as 0 or 1, and the minimization algorithm/fit fails to converge. When that occurs, you could end up with a bad fit curve, or messages asking you to fix a particular parameter or other.

What version of Origin are you using? If you have version 7.0 or higher, you can add a script line:
nlsf.execute(parainit);
to auto initialize the parameters once you have chosen you fitting function and assigned datasets.

If you are running earlier versions, you may need to manually set the parameter values in your code, such as:
nlsf.p1=somevalue;
nlsf.p2=somevalue;
or use some functions to guess good initial values (which is what is done in version 7 and later using parainit).

Then the fit should converge better.

If you have more questions, please post or contact tech support directly for further help with scripting.

Easwar
OriginLab


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