打印拟合结果到Gnuplot的终端

时间:2014-11-13 14:24:56

标签: printing gnuplot

我想执行一项非常简单的任务,我无法实现自己。我想使用拟合参数,例如a1,a2,a3,用它做一些基础数学,并将结果打印到我的终端作为一个简单的输出(如cout“Hello World”)。

我在Gnuplot中想要这样的东西:

print 'the result C = a0+a1+a2'

输出如(例如,如果所有参数都等于1)

the result C = 3

非常感谢提前

2 个答案:

答案 0 :(得分:1)

使用sprintf根据某些变量格式化字符串:

print sprintf('the result is C = %.2f', a0 + a1 + a2)

答案 1 :(得分:1)

如果您还需要错误,请执行以下操作:

set fit errorvariables
fit ...
print sprintf(' a0 has been determined to %d  +/- %d', a0, a0_err)

由于set fit命令,在拟合后每个变量都会有一个额外的变量*_err"