4

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

double-beep
  • 5,031
  • 17
  • 33
  • 41
physnolimits
  • 195
  • 2
  • 2
  • 5

2 Answers2

5

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.

Christoph
  • 47,569
  • 8
  • 87
  • 187
-2

Since there is no code that you tried beforehand so we can edit it, I'm providing a very generic solution here.

For linear fit, use using (1) in your fit command for equal weights. For examples of fit command syntax, see this one. Of course, the manual has complete details of fit and using.

Community
  • 1
  • 1
Emacs User
  • 1,457
  • 1
  • 12
  • 19