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


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

Re: Undefined value during function evaluation

Path csiph.com!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Karl Ratzsch <mail.kfr@gmx.net>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Undefined value during function evaluation
Date Tue, 27 Jun 2017 18:01:28 +0200
Organization solani.org
Lines 71
Message-ID <oitvgn$rbc$1@solani.org> (permalink)
References <c0cd7d4c-8778-4302-9cd7-f1ed87d5734b@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace solani.org 1498579287 28012 eJwFwQERADEIAzBLMNZC5TD+8C/hEwSdk5fgxWLj0JhMwezrjkZJZJefeCXTunRYM28TMT/ziw/7 (27 Jun 2017 16:01:27 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Tue, 27 Jun 2017 16:01:27 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1
Cancel-Lock sha1:oScLiJCDK3FkM/nH2NZhiYfZCf0=
X-NNTP-Posting-Host eJwNwoERACEIA7CZlLbiOEpl/xH+L2FoqBZEgf1DJN6+vKciqcTYs7yAJ3Y53MehmvBMtT8U3BFF
In-Reply-To <c0cd7d4c-8778-4302-9cd7-f1ed87d5734b@googlegroups.com>
X-User-ID eJwFwQEBwDAIAzBLsNKCHb6BfwlPCLluhqjgcuuhizB+F2QdbwJvrGZnvKVI69Rabp6Y/gEQARDQ
Content-Language de-DE-1901
Xref csiph.com comp.graphics.apps.gnuplot:3682

Show key headers only | View raw


Am 27.06.2017 um 15:54 schrieb schmidtanna114@gmail.com:
> Gnuplot always ansers with this problem:
> Current data point
> =========================
> #               = 31 out of 55
> x               = 100000         
> z               = 225            
> 
> Current set of parameters
> =========================
> a               = 100000         
> b               = 0.00015        
> d               = 30             
> 
>          "Einzelspalt.plt", line 10: Undefined value during function evaluation
> 
> 
> 
> My input is:
> 
> a=100000
> b=0.15e-3
> c=633e-9
> d=30
> e=880
> f(x)=((a)**2)*((b)**2)*((c/(pi*b*sin(atan((x-d)/e))))**2)*((sin((pi*b*sin(atan((x-d)/e)))/c))**2)
> fit f(x) 'Einzelspalt.txt' using ($1):($2) via a,b,d
> plot f(x), 'Einzelspalt.txt' using ($1):($2)
> 
> If I comment the fit out, gnuplot plots the Funktion f(x) with the values for a,b,c,d,e that I have definied before. And it also plots the data of "Einzelspalt.txt". I tested it with a polynomial as f(x), what makes no physikal sense, and it worked. Gnoplot fitted that polynomial to my data and gave me the values.
> Because it prints the function in case that I don´t want to fit it, I think gnuplot also "understands" f(x).
> So I can not imagine what the problem is. Could anyone help me, please?
> 

(b^2 cancels out, if I did the math right, leaving b only in the last
sinus. So your function simplifies to

f(x) = a**2 * c**2 * (1/(pi*sin(atan((x-d)/e))))**2 *
(sin((pi*b*sin(atan((x-d)/e)))/c))**2

And gnuplot expects angles in radians, not degrees. I guess from your
starting value of "d" your datafile contains abscissa values in degrees,
right?

 fit f(x) dataf us ($1/180*pi):2 via a,b,d,e
 plot f(x), dataf us ($1/180*pi):2

 )

Are the supplied parameters in the right region, i.e. is the function
already close to the data _before fitting_?

The function you give is complicated enough to never converge on your
data if the starting parameters are off. At some point most probably a
division by zero happened due to diverging parameter values.

Try predetermining the parameters using simpler functions e.g. only on a
part of the whole dataset, or by using the "stats" command:

  stats "Einzelspalt.txt" us ($1/180*pi):2
  d=STATS_pos_max_y
  # run the fit without d
  # then re-fit all variables



  Karl



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


Thread

Undefined value during function evaluation schmidtanna114@gmail.com - 2017-06-27 06:54 -0700
  Re: Undefined value during function evaluation Karl Ratzsch <mail.kfr@gmx.net> - 2017-06-27 18:01 +0200
  Re: Undefined value during function evaluation schmidtanna114@gmail.com - 2017-06-27 12:40 -0700
  Re: Undefined value during function evaluation Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2017-06-27 21:44 +0200
  Re: Undefined value during function evaluation schmidtanna114@gmail.com - 2017-06-28 07:16 -0700

csiph-web