gnuplot fit 是否有任何错误变量?

Is there any error variable for gnuplot fit?

我正在制作一个 c++ 代码,它为 gnuplot 打印命令,以便更快地绘制不同的东西。代码已经在数据拟合时绘制了数据,但现在我添加了一些标签,我想打印拟合方程,我的意思是这种形式

f(x) = (a +/- Δa)*x + (b +/- Δb)

我有下面一行打印它

set label 1 at screen 0.22, screen 0.75 sprintf('f(x) = %3.4f*x + %3.4f', a, b)

但是,正如您所看到的,只有 a 和 b 值没有错误,我在想像在 sprintf 函数中放置任何与错误相关的变量 (FIT_something) 和然后有类似

的东西
set label 1 at screen 0.22, screen 0.75 sprintf('f(x) = (%3.4f +/- %3.4f)*x + (%3.4f + %3.4f)', a, deltaa, b, deltab)

但我找不到那些,我的答案是:那些存在吗?如果答案是否定的,是否有任何方法可以进一步打印变量错误,只需将其明确地写在行上即可?

感谢您的帮助

请阅读 gnuplot 文档的统计概述部分 (help statistical_overview)。请记住此处描述的注意事项,另请参阅 set fit errorvariables 的文档,我将其摘录如下:

 If the `errorvariables` option is turned on, the error of each fitted
 parameter computed by `fit` will be copied to a user-defined variable
 whose name is formed by appending "_err" to the name of the parameter
 itself.  This is useful mainly to put the parameter and its error onto
 a plot of the data and the fitted function, for reference, as in:

        set fit errorvariables
        fit f(x) 'datafile' using 1:2 via a, b
        print "error of a is:", a_err
        set label 1 sprintf("a=%6.2f +/- %6.2f", a, a_err)
        plot 'datafile' using 1:2, f(x)

 If the `errorscaling` option is specified, which is the default, the
 calculated parameter errors are scaled with the reduced chi square.  This is
 equivalent to providing data errors equal to the calculated standard
 deviation of the fit (FIT_STDFIT) resulting in a reduced chi square of one.