I have some data which when I give the fit an expectation value it will correctly fit a gaussian to my data. If I don't give it the expectation value it draws a horizontal line across my data (fit hasn't worked).
The reason why I want to get the fit to work without an expectation value is so that I can compare the difference in the location of the peaks.
edit:
The expectation value 'expect' is the x-position that has the highest y-value (peak of my data).
pos = argmax(ydata)
expect = xdata[pos]
If I don't use the expectation value I force the gaussian to be at the centre of my plot
xdata[29]
where 29 is the central bin across my data (60 bins total). When I do this I get a flat line. I would expect this fit to be worse, but it should give me some sort of gaussian looking fit.