1

I have a file called 'dataset.txt' with inside these data

#Temperature (K) - Pressure (kPa)

310.2 5.349
315.6 6.682
320.2 8.015
325.2 10.681
330.2 14.680
335.2 17.346
340.2 22.678
345.2 28.010
350.2 34.675
355.2 44.006
360.2 52.004
365.2 62.668
370.2 73.332

I have to fit the curve given by data with an exponential of the form

f(x) = a * exp(x * b) + c

So i digit

f(x) = a*exp(x*b) + c
fit f(x) 'dataset.txt' u 1:2 via a, b, c

but I get an error of the type

Current data point
=========================
#               = 1 out of 13
x               = nan            
z               = 5.349          

Current set of parameters
=========================
a               = nan            
b               = nan            
c               = 1              

     Function evaluation yields NaN ("not a number")

Can anyone explain me why? Is there a syntax error? I have already fitted this curve with Origin (on Windows) and no problems occurred. Why does gnuplot give me this strange error? Thx!

opisthofulax
  • 517
  • 8
  • 25

1 Answers1

3

This is a floating point number problem.

You do not initialise the fit parameters, so gnuplot chooses default values a=b=c=1. Evaluating the exponential function exp(x*b) now results in huge values, which leads to (floating point) Infinity and NaN in the Marquardt-Levenberg fitting algorithm.

Try to initialise the fit parameters, especially b, for example b=0.001.

opisthofulax
  • 517
  • 8
  • 25
maij
  • 4,094
  • 2
  • 12
  • 28
  • Wow, thanks, this solved my problem. I initialised only `b`... But I still don't get the point. By the way, thanks a lot! – opisthofulax Jan 11 '17 at 21:53