I'm having a bit of trouble fitting data to a function. I've been able to figure 'fit' out for a simpler equation but this is starting to frustrate me.
If I recall correctly, in old versions of gnuplot you could use a command
fit [u=*:*][v=*:*][w=*:*] z(u,v,w) 'disc.dat' using 1:2:3:4:(1) via a,b,c,d
But the old syntax was different than it is now, so the command may do something different even apart from the mechanism for specifying dummy variables. I'm not all that familiar with the way the fit command used to work.
Last edit: Ethan Merritt 2016-06-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm having a bit of trouble fitting data to a function. I've been able to figure 'fit' out for a simpler equation but this is starting to frustrate me.
My data looks like:
(u,v,w,z)
1.02E+07 16.118 0.3 21.4407
1.09E+07 16.694 0.3 23.4789
1.63E+07 17.269 0.3 24.0529
2.71E+07 17.845 0.3 24.629
2.04E+07 14.967 0.4 18.6672
4.13E+07 16.118 0.4 19.755
5.32E+07 16.693 0.4 20.3117
2.58E+07 13.816 0.5 15.1346
4.44E+07 14.967 0.5 16.273
6.92E+07 16.118 0.5 17.8814
3.32E+07 13.816 0.55 14.0436
8.11E+07 16.118 0.55 16.4112
6.10E+07 13.816 0.7 11.0344
9.59E+07 14.967 0.7 10.9452
1.16E+08 16.118 0.7 13.1881
9.23E+07 13.816 0.9 7.7384
1.64E+08 14.967 0.9 8.6636
2.71E+08 16.118 0.9 9.5059
I have a function z(u,v,w) = (au^b)/((v^c)(w^d))
(I typically use * for multiply and ** as exponent)
I specify the function and attempt to fit to data:
gnuplot> z(u,v,w) = (aub)/((vc)(w**d))
gnuplot> fit z(u,v,w) 'fbotfit.dat' using 1:2:3:4:(1) via a,b,c,d
undefined variable: w
I get stuck with the undefined variable. How can I fix this so that I have the unknown variables
a, b, c and d returned with their uncertainties?
Thanks,
You told us
But you did not tell this to gnuplot. Normally it thinks the first 3 columns are x/y/z
Try adding a line at the beginning
gnuplot> set dummy u,v,w
I tried something like that before I posted. Perhaps I should have had added that I get the following line:
gnuplot> set dummy u, v, w
^ (arrow under the comma after v)
';' expected
Last edit: Joshua Guerrero 2016-06-16
What version of gnuplot are you using?
If I recall correctly, in old versions of gnuplot you could use a command
But the old syntax was different than it is now, so the command may do something different even apart from the mechanism for specifying dummy variables. I'm not all that familiar with the way the fit command used to work.
Last edit: Ethan Merritt 2016-06-16
Wow. The line you gave me worked like a charm! Thank you so much.
I'll have to get to the bottom of how it works in my version.
I was using:
G N U P L O T
Version 4.6 patchlevel 4 last modified 2013-10-02
Build System: Linux i686