How to do a fit with gnuplot using data with error in x and y?

physnolimits picture physnolimits · Sep 5, 2015 · Viewed 17k times · Source

How to do a fit with data like x y deltax delta y? I have to do a linear fit weighted to the error in both axis what is the exact syntax?

Fit f (x) "file.txt" u1:2:3:4 via a, b with xyerrorbars.

f (x) =a*x + b

Result: singular matrix in invert_RtR

Answer

Christoph picture Christoph · Sep 5, 2015

To fit with x and y errors you need gnuplot 5. Then use the syntax

f(x) = a*x + b
fit f(x) "file.txt" using 1:2:3:4 xyerrors via a,b

See the last example on http://gnuplot.sourceforge.net/demo_5.0/fit.html for a full demo.