【发布时间】:2015-04-23 15:48:40
【问题描述】:
数据
Model Decreasing-err Constant-err Increasing-err
2025 73-78 80-85 87-92
2035 63-68 80-85 97-107
2050 42-57 75-90 104.5-119.5
here 描述了哪个数据结构(使用 -err)。
为了绘制点,我运行
set terminal qt size 560,270;
set grid; set offset 1,1,0,0;
set datafile separator " -";
set key autotitle columnhead;
plot for [i=2:6:2] "data.dat" using 1:(0.5*(column(i)+column(i+1))):(0.5*(column(i+1)-column(i))) with yerror;
得到
但是,我想为这些点添加一条线,由于扭结,您不能仅使用 with yerrorlines 来完成。
我的用于拟合递增和递减线的伪代码
inc(x) = k1*x + k2;
con(x) = n1*x + n2;
dec(x) = m1*x + m2;
fit inc(x), con(x) dec(x) for [i=2:6:2] "data.dat"
using 1:(0.5*(column(i)+column(i+1))):(0.5*(column(i+1)-column(i)))
via k1,k2,n1,n2,m1,m2;
问题在于将函数fit 与for 循环一起使用。
如何在 for 循环中使用 Gnuplot 的 fit? 我想同时为数据拟合多条线。
【问题讨论】: