2012-05-27 24 views
0

我經常使用Octave創建數據,我可以從我的實驗室結果中繪製數據。然後,該數據被配備在gnuplot的一些功能:從gnuplot獲取適合的數據

f1(x) = a * exp(-x*g); 
fit f1(x) "c_1.dat" using 1:2:3 via a,g 

,創建一個fit.log

******************************************************************************* 
Tue May 8 19:13:39 2012 


FIT: data read from "e_schwach.dat" using 1:2:3 
     format = x:z:s 
     #datapoints = 16 
function used for fitting: schwach(x) 
fitted parameters initialized with current variable values 



Iteration 0 
WSSR  : 12198.7   delta(WSSR)/WSSR : 0 
delta(WSSR) : 0     limit for stopping : 1e-05 
lambda : 14.2423 

initial set of free parameter values 

mu2    = 1 
omega2   = 1 
Q2    = 1 

After 70 iterations the fit converged. 
final sum of squares of residuals : 46.0269 
rel. change during last iteration : -2.66463e-06 

degrees of freedom (FIT_NDF)      : 13 
rms of residuals  (FIT_STDFIT) = sqrt(WSSR/ndf) : 1.88163 
variance of residuals (reduced chisquare) = WSSR/ndf : 3.54053 

Final set of parameters   Asymptotic Standard Error 
=======================   ========================== 

mu2    = 0.120774   +/- 0.003851  (3.188%) 
omega2   = 0.531482   +/- 0.0006112 (0.115%) 
Q2    = 17.6593   +/- 0.7416  (4.199%) 


correlation matrix of the fit parameters: 

       mu2 omega2 Q2  
mu2    1.000 
omega2   -0.139 1.000 
Q2    -0.915 0.117 1.000 

有沒有辦法讓參數及其錯誤回到八度?我的意思是我可以編寫一個解析該程序的Python程序,但我希望避免這種情況。

更新

這個問題並不適用於我了,因爲我使用Python和matplotlib我的實驗室工作,現在,它可以做這一切,從一個單一的程序。如果其他人有同樣的問題,我會留下這個問題。

回答

3

我不很瞭解gnuplot的倍頻接口,但什麼可以讓你的(解析)的生活更輕鬆是您可以:

set fit errorvariables 
fit a*x+g via a,g 
set print "fit_parameters.txt" 
print a,a_err 
print g,g_err 
set print 

現在你的變量及其相關的錯誤是在文件「 fit_parameters.txt「與 不需要從python解析。

從文檔上fit

如果gnuplot的是使用此選項生成,並且您激活它使用set fit errorvariables,每個安裝參數的誤差將被存儲在一個名爲像參數變量 ,但附有_err 。因此,這些誤差可以用作進一步計算的輸入。

+0

這看起來像是邁向正確方向的一步。謝謝! –