I'm trying to write code to automatically fit binned simulation data with a Gaussian function, but I'm getting a "Singular matrix in Invert_RtR" error when performing the fit.
I'm currently using gnuplot version 5.0.3 on Windows 8. Code and data are attached below.
Any help / guidance would be much appreciated.
Thanks.
gnuplot code:
reset
unset key
set xlabel "Time of Flight"
set ylabel "Counts"
A = 218.0
Mean = 3561.978563
StdDev = 0.008026
f(x) = A*exp(-(x-Mean)**2/(2*StdDev**2))
set fit errorvariables
fit [3561.851:3562.008] f(x) "histoTest.txt" u 1:2:3 yerror via A,Mean,StdDev
plot "histoTest.txt" u 1:2:3 w yerrorbars, f(x)
Contents of my data file (please note, the error values are the square root of the counts, but when this would be 0, I chose a value of 0.0001 to try to avoid issues):
Hello,
I'm trying to write code to automatically fit binned simulation data with a Gaussian function, but I'm getting a "Singular matrix in Invert_RtR" error when performing the fit.
I'm currently using gnuplot version 5.0.3 on Windows 8. Code and data are attached below.
Any help / guidance would be much appreciated.
Thanks.
gnuplot code:
Contents of my data file (please note, the error values are the square root of the counts, but when this would be 0, I chose a value of 0.0001 to try to avoid issues):