Troubles fitting exponential with gnuplot

被刻印的时光 ゝ 提交于 2019-12-11 04:47:43

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/41600124/troubles-fitting-exponential-with-gnuplot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!