set terminal png
set output "temperature.png"

set key under
set xlabel "ADC value [-]"
set ylabel "Temperature [°C]"

f(x)= k*x + q
fit f(x) "calibration_data.txt" using 2:1 via k,q


# from http://hw.cz/docs/mereni_teploty/mereni_teploty_1.html/
A=3.90802e-3
B=-5.802e-7
g(x)=(-A + sqrt(A*A - 4*B*(1.0 - 1.0*x*2350.0/1024.0/1000.0)))/2.0/B;

plot "calibration_data.txt" using 2:1 with points title "measured points", f(x) title "0.674201 * x - 294.35", g(x) title "original hw.cz"