| Author |
Topic  |
|
|
vassilios_1
Germany
4 Posts |
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!!
|
|
|
easwar
USA
1965 Posts |
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
|
 |
|
| |
Topic  |
|
|
|