Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Gnuplot拟合时间序列_Gnuplot_Time Series_Curve Fitting_Linear Regression - Fatal编程技术网

使用Gnuplot拟合时间序列

使用Gnuplot拟合时间序列,gnuplot,time-series,curve-fitting,linear-regression,Gnuplot,Time Series,Curve Fitting,Linear Regression,我是Gnuplot的忠实粉丝,现在我想用fit函数来表示时间序列 我的数据集如下所示: 1.000000 1.000000 0.999795 0.000000 0.000000 0.421927 0.654222 -25.127700 1.000000 1994-08-12 1.000000 2.000000 0.046723 -0.227587 -0.689491 0.328387 1.000000 0.000000 1.000000 1994-08-12 2.000000 1.000000

我是Gnuplot的忠实粉丝,现在我想用fit函数来表示时间序列

我的数据集如下所示:

1.000000 1.000000 0.999795 0.000000 0.000000 0.421927 0.654222 -25.127700 1.000000 1994-08-12
1.000000 2.000000 0.046723 -0.227587 -0.689491 0.328387 1.000000 0.000000 1.000000 1994-08-12 
2.000000 1.000000 0.945762 0.000000 0.000000 0.400038 0.582360 -8.624480 1.000000 1995-04-19 
2.000000 2.000000 0.060228 -0.056367 -0.680224 0.551019 1.000000 0.000000 1.000000 1995-04-19
3.000000 1.000000 1.016430 0.000000 0.000000 0.574478 0.489638 -3.286880 1.000000 1995-07-15
还有我的剧本:

set timefmt "%Y-%m-%d"
set xdata time
set format x "%Y-%m-%d"
f(x)=a+b*x
fit f(x) "model_fit.dat" u 10:($2==2?$4:1/0) via a,b
所以我对时间数据进行了条件拟合。 我的问题是,Gnuplot fit函数对时间数据不起作用。 我在这里发现了一个类似的问题:但我不想使用其他软件。我也不知道如何将时间值改为数字,然后再改回来

有人能帮我用Gnuplot解决这个问题吗


非常感谢

事实上,gnuplot的拟合机制对时间数据很有效。你必须只注意一些细节

通常,通过两个数据点的线性拟合可以精确求解。但是gnuplot通常是非线性拟合的,所以初始值很重要

线路使用的有效x值以秒为单位。在这里使用初始值
b=1e-8
可以很好地工作:

set timefmt "%Y-%m-%d"
set xdata time
set format x "%Y-%m-%d"
f(x)=a+b*x
a = 1
b = 1e-8
fit f(x) "model_fit.dat" u 10:($2==2?$4:1/0) via a,b

plot "model_fit.dat" u 10:($2==2?$4:1/0) lt 1 pt 7 title 'data',\
     f(x) w l lt 1 title 'fit'

我穿不上这件衣服。。。gnuplot说拟合在3次迭代后收敛。拟合后,a的值一点也没有改变!所以我认为gnuplot在安装a时有一些问题。(参数b的拟合度看起来不错)您有哪种gnuplot版本?我用5.0进行了测试。尝试将fitI use 4.6的a设置为-7。gnuplot的版本,现在我将它升级到5.0版。然后再试一次。它与gnuplot 5.0配合得很好。为了我。谢谢!