|
From: Carl M. <mi...@ph...> - 2011-03-10 23:06:30
|
Hello, I am hoping to drum up a little support to get a small patch accepted. My issue is with the scaling of fit parameters in gnuplot's 'fit' command. Fit is pretty robust, but if you have a function like: f(x) = a * exp(-b*x*x) + c where the values of the parameters differ by many orders of magnitude (eg a,c = 1e7 and b = 1e-7) the fit command will fail badly. One solution is to redefine the function so the parameters are of similar size, but it's easy to have gnuplot do this internally based on the initial values of the parameters. I've written a tiny patch to do this: http://sourceforge.net/tracker/?func=detail&aid=3106206&group_id=2055&atid=302055 I've tested this against test cases such as the one above, and also all of the fits in fit.dem. The patch actually makes most of the fits converge in fewer iterations, and for fits where the parameters are very different in size, it now converges where it didn't at all before. The patch is very non-invasive. It adds 13 lines and modifies 7 others, all in fit.c We use gnuplot in undergraduate teaching labs a lot, and this solves one of the most common problems we see with students using it for fitting. Carl |