1

I try to fit my data file with a power law so I have:

f(x) = a*x**b //
fit f(x) 'data.txt' u 1:2 via a,b //
plot 'data,txt' u 1:2 with points, f(x)

My data are:

0.0001 2.283205 //
0.0002 3.007995 //
0.0003 3.535115 //
0.0004 3.960405 //
0.0005 4.331785 //
0.0006 4.655245 //
0.0007 4.954745 //
0.0008 5.224295 // 
0.0009 5.475875 //
0.001  5.709485 //

But in the end I just have the dots coming from my datas but I do not have the function.

enter image description here

Does someone know what happens and how I can get the plot for the function ?

Thank you in advance.

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
Xkcd
  • 11
  • 2

1 Answers1

1

I don't see problems... if you start with some "reasonable" values for a and b.

Code:

### fitting
reset session


$Data <<EOD
0.0001 2.283205
0.0002 3.007995
0.0003 3.535115
0.0004 3.960405
0.0005 4.331785
0.0006 4.655245
0.0007 4.954745
0.0008 5.224295
0.0009 5.475875
0.001  5.709485
EOD

a=1
b=0.5

f(x) = a*x**b
set fit nolog results
fit f(x) $Data u 1:2 via a,b

plot $Data u 1:2 with points, f(x)
### end of code

Results:

Final set of parameters            Asymptotic Standard Error
=======================            ==========================
a               = 89.4411          +/- 0.1635       (0.1828%)
b               = 0.398318         +/- 0.0002467    (0.06193%)

enter image description here

theozh
  • 22,244
  • 5
  • 28
  • 72