0

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.

user1958508
  • 605
  • 3
  • 7
  • 10
  • Why not just initialise the expectation to the argmax of your input data? – ali_m Aug 21 '13 at 13:42
  • If you allow your gaussian to have zero amplitude then you can still get a flat line back. I still don't understand why you wouldn't want to initialise your fit with `argmax(ydata)`. – ali_m Aug 21 '13 at 14:33

0 Answers0