set key right bottom

#set size .9,.85

set fit errorvariables
set ylabel "$\\frac{B}{\\mathrm{T}}$"
set xlabel "$\\frac{I}{\\mathrm{A}}$"

set decimalsign ','
set samples 5000

#set xtic 11
#set ytics 1

A = 1.2
B = 20

f(x) = A*(1 - exp(-x/B))
fit f(x) 'kalibrace2.dat' using 1:2 via A,B
plot 'kalibrace2.dat' using 1:2 lt 1 title 'Naměřené hodnoty', f(x) lt 1 title 'Proložená závislost'

set terminal latex
set out "grafkalibrace2.tex"
replot
set out
set term win

set print "fitkalibrace2.txt"
print "   A*(1 - exp(-x/B))"
print A, " +/- ", A_err, ",   rel. chyba ", abs(A_err/A*100), " %"
print B, " +/- ", B_err, ",   rel. chyba ", abs(B_err/B*100), " %"
#print C, " +/- ", C_err, ",   rel. chyba ", abs(C_err/C*100), " %"
set print