fitting a function with multiple data sets using gnuplot

后端 未结 1 570
我在风中等你
我在风中等你 2021-01-25 17:51

I would like to fit a function using many data sets. For example, I reproduce an experience many times, each time I obtain a pair of data column (x,y). I put all these column in

相关标签:
1条回答
  • 2021-01-25 18:20

    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
    
    0 讨论(0)
提交回复
热议问题