2013-05-13 99 views

回答

1

我設法生產工作版本以上擅長人物。然而,任何改進都非常感謝。 謝謝。 我在gnuplot的代碼是

 set terminal svg enhanced fname "Times-New-Roman,12" 
     set xlabel "x" 
     set ylabel "y" 
     set xrange [0:*] 
     set yrange [0:*] 
     set format x "%0.3f" 
     set format y '%0.3f' 
     set title sprintf("y=f(x)") 

     # plot 
     filename="data.txt" 
     plotfile="out.svg" 
     set output plotfile 
     f(x)=a*x**b 
     fit f(x) filename using 10:11 via a,b 
     set label GPFUN_f at graph .15,.95 
     set label sprintf("a = %g",a) at graph .15,.90 
     set label sprintf("b = %g",b) at graph .15,.85 
     plot filename using 10:11 title "y(x)" with points pointtype 1 pointsize 1,\ 
    f(x) title "power-trendline" with line linewidth 2 

[電站趨勢線-的gnuplot] enter image description here

+1

爲什麼不使用 「增強型」 方法可行像這樣: '設置標籤的sprintf(「Y(X)=% fx^{%f}「,a,b)在圖.15,.95'而不是在圖.15,.95'上設置標籤GPFUN_f? – 2013-05-17 01:58:09

+1

你甚至可以控制像這樣的重要數字的數量: 'set label sprintf(「y(x)=%。4f.x^{%。3f}」,a,b)' – 2013-05-17 02:04:37

+0

@Heisenberg謝謝,該圖表如何將R^2值添加到上圖中的圖形? – maxm 2013-05-17 20:09:28