'How do I improve my fit of the double slit diffraction in gnuplot?

I wrote this code to fit the intensity equation of a double slit diffraction over my measured data. The problem is that the fit graph isnt proportional to the plot of the measured data. The measured data is a txt file looking like this:

0 0 10224 
1 1.00048851978505 10460
...
1050 1050.5129457743 59573
...
2047 2048 10518

I tried to have as many variables as possible to give the fit function options to align to the plot and provide good starting values for my variables but the fit still isnt anywhere near the mesured data points altough it seems to be of the right shape. The function winkel(x) is used to convert the measured x values (second vertical column) from pixels to radian, cause the formula for the intensity Int(x) (https://de.wikipedia.org/wiki/Doppelspaltexperiment) is made for radian and I measured the width of the interference pattern with a 2048 pixels wide camera sensor.

set title "Intensity"
set xlabel "pixels"
set ylabel "tics"
#d slit distance
#a slit width
#b proportional constant
#c,g moves the center of the fit function
#lambda wave length of the light
#Int(x) intensity function
#k maximum distraction angle thats still on the screen and measured
pi = 3.14159
lambda = 632.816e-9
winkel(x) = -k+2*k*(x+g)/2048
beta(x) = (pi*d/lambda)*sin(winkel(x))
alpha(x) = (pi*a/lambda)*sin(winkel(x))
f(x)=b*(cos(beta(x))**2) * ((sin(alpha(x))/alpha(x))**2)+c
a=0.0006
d=0.0002
b=60000
c=10000
g=50
k=0.002
fit f(x) "...\\2ohnefilter.txt" using 2:3 via a,b,c,d,g,k
plot "...\\2ohnefilter.txt" using 2:3 , f(x)

The fit function should be as high and wide as the plot of the measured data, how can I achieve this? Thanks in advance.



Solution 1:[1]

the trick was to narrow down the start values of the variables by hand till a fit almost wasnt necessary anymore. Thanks anyway. If someone ist curious k was the relevant variable that made the most difference.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 General Grievance