fitting a function with multiple data sets using gnuplot

孤者浪人 提交于 2019-12-02 07:24:06

You can process your data so that columns 1, 3 and 5 all become the same column 1, and columns 2, 4 and 6 all become the same column 2. It's easy with awk, you can do it outside gnuplot:

awk '{print $1, $2} {print $3, $4} {print $5, $6}' data.txt > data2.txt

and then fit it within gnuplot:

f(x)=a*x+b
fit f(x) "data2.txt" u 1:2:(0.25) via a,b

Or you can do it completely within gnuplot without any intermediate file:

f(x)=a*x+b
fit f(x) "< awk '{print $1, $2} {print $3, $4} {print $5, $6}' data.txt" u 1:2:(0.25) via a,b
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!