告诉 gnuplot 忽略它不适合的函数
Tell gnuplot to ignore functions it cannot fit
我正在尝试使用 gnuplot 将各种数据集拟合到某个拟合函数。我的一些数据文件无法拟合这些函数(因为我的数据很嘈杂并且它们包含太多 NaN)并且一些拟合函数不起作用(如这个问题中所述:),因为我这样做没有为我的拟合参数指定初始值。
当然,一个解决方案是为每个数据集仔细选择拟合参数,而不是尝试拟合明显不适合候选拟合函数的函数。但是,因为我只是想感受一下数据,而且我需要制作大约 1000 个图,有没有一种方法可以指定一些选项,比如“如果拟合失败,设置拟合函数 f(x)=0
"?
注意:How to tell gnuplot to ignore non-converging fits没有回答我的问题;当我 运行 gnuplot (gnuplot-qt, Linux, v. 5.2 patchlevel 8) 然后对于我的一些数据集它失败并出现错误
Current data point
=========================
# = 1 out of 3
x = 5.93738
z = 5.97972
Current set of parameters
=========================
a = 5.93738
b = 25.7958
c = 73.596
"fitting.gp" line 68: Function evaluation yields NaN ("not a number")
gnuplot>
(这里 a、b、c 是我的拟合参数,我通过输入 gnuplot > load "filename"
来 运行ning gnuplot。
编辑:除了拟合函数因某些参数组合未定义而崩溃外,有时拟合也会失败并出现错误“Singular matrix in Invert_RtR
”。在所有这些情况下,我想告诉 gnuplot 继续尝试拟合它可以拟合的数据集,并无论如何绘制结果数据集(并拟合,如果可用)。
我认为没有仅 gnuplot 的解决方案。
源码中有如下注释(src/fit.c):
/* FIXME: It would be nice to exit the "fit" command non-fatally, */
/* so that the script who called it can recover and continue. */
/* int_error() makes that impossible. But if we use int_warn() */
/* instead the program tries to continue _inside_ the fit, which */
/* generally then dies on some more serious error. */
这些行在我的 gnuplot 5.0.5 和当前源代码(5.4?)中。
我正在尝试使用 gnuplot 将各种数据集拟合到某个拟合函数。我的一些数据文件无法拟合这些函数(因为我的数据很嘈杂并且它们包含太多 NaN)并且一些拟合函数不起作用(如这个问题中所述:
当然,一个解决方案是为每个数据集仔细选择拟合参数,而不是尝试拟合明显不适合候选拟合函数的函数。但是,因为我只是想感受一下数据,而且我需要制作大约 1000 个图,有没有一种方法可以指定一些选项,比如“如果拟合失败,设置拟合函数 f(x)=0
"?
注意:How to tell gnuplot to ignore non-converging fits没有回答我的问题;当我 运行 gnuplot (gnuplot-qt, Linux, v. 5.2 patchlevel 8) 然后对于我的一些数据集它失败并出现错误
Current data point
=========================
# = 1 out of 3
x = 5.93738
z = 5.97972
Current set of parameters
=========================
a = 5.93738
b = 25.7958
c = 73.596
"fitting.gp" line 68: Function evaluation yields NaN ("not a number")
gnuplot>
(这里 a、b、c 是我的拟合参数,我通过输入 gnuplot > load "filename"
来 运行ning gnuplot。
编辑:除了拟合函数因某些参数组合未定义而崩溃外,有时拟合也会失败并出现错误“Singular matrix in Invert_RtR
”。在所有这些情况下,我想告诉 gnuplot 继续尝试拟合它可以拟合的数据集,并无论如何绘制结果数据集(并拟合,如果可用)。
我认为没有仅 gnuplot 的解决方案。
源码中有如下注释(src/fit.c):
/* FIXME: It would be nice to exit the "fit" command non-fatally, */ /* so that the script who called it can recover and continue. */ /* int_error() makes that impossible. But if we use int_warn() */ /* instead the program tries to continue _inside_ the fit, which */ /* generally then dies on some more serious error. */
这些行在我的 gnuplot 5.0.5 和当前源代码(5.4?)中。