用gnuplot拟合指数的问题 [英] Troubles fitting exponential with gnuplot

查看:130
本文介绍了用gnuplot拟合指数的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为 dataset.txt的文件,其中包含这些数据

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

我是数字

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

,但是出现类型错误

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

有人可以解释我为什么吗?是否存在语法错误?我已经用Origin(在Windows上)拟合了此曲线,并且没有发生任何问题。 gnuplot为什么会给我这个奇怪的错误?
Thx!

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!

推荐答案

这是一个浮点数问题。

This is a floating point number problem.

您没有初始化fit参数,因此gnuplot选择默认值 a = b = c = 1 。现在计算指数函数 exp(x * b)会产生巨大的值,这会导致(浮点数)无穷大和 NaN 在Marquardt-Levenberg拟合算法中。

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.

尝试初始化拟合参数,例如,特别是 b b = 0.001

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

这篇关于用gnuplot拟合指数的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆