1
votes

I'm trying to fit a function in gnuplot. My data is:

1.0  0.000
2.0  0.00
7.0  15.3
10.0  34.6
20.0  49.3
70.0  82.6
200.0  96.0
1000.0  100.0

I wrote a code:

set mxtics 2
set mytics 2
set key left top
set ylabel "F'/F"
set xlabel "c [l/{/Symbol m}g]"
f(x)= x/(x+k)

fit f(x) 'adrenalin.txt' using 1:2 via k
plot 'adrenalin.txt' using 1:2 t"" , f(x) t"" 

And the fit is totally of. I have no idea what is wrong. And I have to use f(x)= x/(x+k) for fitting. can anyone helps? thank you

1

1 Answers

1
votes

Judging from you data, you need k > 0. In that case, your function x/(x+k) will always be far off your data which goes up to 100. So you must either use a function f(x) = 100*x/(x+k) or scale your data by a factor of 100:

set mxtics 2
set mytics 2
set key left top
set ylabel "F'/F"
set xlabel "c (in l/{/Symbol m}g)"
f(x)= 100*x/(x+k)

fit f(x) 'adrenalin.txt' using 1:2 via k
plot 'adrenalin.txt' using 1:2 t "" , f(x) t sprintf("x/(x+%.2f)", k) 

enter image description here