X-Received: by 10.66.89.74 with SMTP id bm10mr1911072pab.19.1356103930479; Fri, 21 Dec 2012 07:32:10 -0800 (PST) Received: by 10.50.106.193 with SMTP id gw1mr5030721igb.2.1356103930426; Fri, 21 Dec 2012 07:32:10 -0800 (PST) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.kjsl.com!usenet.stanford.edu!f6no7874695pbd.1!news-out.google.com!6ni51708pbd.1!nntp.google.com!f6no7874692pbd.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.graphics.apps.gnuplot Date: Fri, 21 Dec 2012 07:32:10 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=65.128.162.237; posting-account=8cqVUQoAAACMqxlqSYFQbFk0lDQXV4ap NNTP-Posting-Host: 65.128.162.237 References: <4da37e57-cdcd-474e-a3c3-7e98f09b1cb6@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <5c431d1b-bbc9-418b-8707-588d0ff79beb@googlegroups.com> Subject: Re: fit gives different results for identical functions with different var names From: Marcus Hanson Injection-Date: Fri, 21 Dec 2012 15:32:10 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: csiph.com comp.graphics.apps.gnuplot:1551 On Friday, December 21, 2012 5:42:08 AM UTC-6, Karl wrote: > Have you initialized all your variables identically for the three > functions? And put all the right variable names in the "via" statement? > Does it help to put all the variables in the function argument list? I have the correct 'via' statements and I have initialized the variables. Here is exactly what I have done: gnuplot>aa=1;ma=1;sa=1;xa=1; gnuplot>fa(xa,aa,ma,sa)=aa*exp(-(xa-ma)**2/(2*sa**2)) gnuplot>fit fa(xa,aa,ma,sa) 'test.dat' u 1:2 via aa,ma,sa This gives aa=55,ma=0.98,sa=1 (rounded off values) with enormous standard errors (on the order of 10^16 to 10^19). These numbers do not even remotely fit the data. On the other hand, I have tried the following: gnuplot>a=1;m=1;s=1;x=1; gnuplot>f(x)=a*exp(-(x-m)**2/(2*s**2)) gnuplot>fit f(x) 'test.dat' u 1:2 via a,m,s This gives a=236,m=-1,s=-2.6 (also rounded), with standard errors less than 10%. This also fits the function remarkably well by all measures I know. I tried various different variable names of more than one character, and they all gave exactly identical results, all of them very wrong. Could this be some setting I accidentally changed a while ago in gnuplot?