감동, 마음이 움직이는 것

[gnuplot] fitting script ver2 본문

Tips (Utility, Computer Language, and etc.)

[gnuplot] fitting script ver2

Struggler J. 2021. 4. 14. 16:32

array A[12]       #array allocate

f(x) = -a*x + b #define a fitting function

do for[i=0:10]{
M = 50+10*i
fname = sprintf('./data/M%d_mu1.1_S2_P.d', M)
fit f(x) fname u 0:(log($1)) via a, b                    #I used log(y) value so that the fitting is done for the exponential function
p f(x) lw 5 t '', fname u 0:(log($1)) t ""
A[i+1] = a                                                          #Save the exponent values
}
print A