Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #1553

Re: fit gives different results for identical functions with different var names

From Hans-Bernhard Bröker <HBBroeker@t-online.de>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: fit gives different results for identical functions with different var names
Date 2012-12-21 19:21 +0100
Message-ID <50D4A8B1.5060708@t-online.de> (permalink)
References <4da37e57-cdcd-474e-a3c3-7e98f09b1cb6@googlegroups.com> <kb1i3c$st5$1@news.rz.uni-karlsruhe.de> <5c431d1b-bbc9-418b-8707-588d0ff79beb@googlegroups.com>

Show all headers | View raw


On 21.12.2012 16:32, Marcus Hanson wrote:
> On Friday, December 21, 2012 5:42:08 AM UTC-6, Karl wrote:

> 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))

Those two lines are overdoing things a bit.  You would normally either 
do it with global variables:

gnuplot>aa=1;ma=1;sa=1;xa=1;
gnuplot>fa(xa)=aa*exp(-(xa-ma)**2/(2*sa**2))
gnuplot>fit fa(xa) 'test.dat' u 1:2 via aa,ma,sa

or locally, using function arguments:

gnuplot>fa(x,a,m,s)=aa*exp(-(xa-ma)**2/(2*sa**2))
gnuplot>fit fa(x,aa,ma,sa) 'test.dat' u 1:2 via aa,ma,sa

But that's not the real problem.  That rather is your use of 'xa'>

> gnuplot>fit fa(xa,aa,ma,sa) 'test.dat' u 1:2 via aa,ma,sa
                  ^^

Where did you expect this 'xa' to come from?

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

fit gives different results for identical functions with different var names marcus.hanson@gmail.com - 2012-12-20 13:01 -0800
  Re: fit gives different results for identical functions with different var names Brendan Halpin <brendan.halpin@ul.ie> - 2012-12-21 00:55 +0000
  Re: fit gives different results for identical functions with different var names Karl <mail.kfr@gmx.net> - 2012-12-21 12:42 +0100
    Re: fit gives different results for identical functions with different var names Marcus Hanson <marcus.hanson@gmail.com> - 2012-12-21 07:32 -0800
      Re: fit gives different results for identical functions with   different var names Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-12-21 19:21 +0100
        Re: fit gives different results for identical functions with   different var names Marcus Hanson <marcus.hanson@gmail.com> - 2012-12-21 11:54 -0800
          Re: fit gives different results for identical functions with     different var names Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-12-22 01:31 +0100

csiph-web