I am using Mathematica for some time now for evaluating experimental data for my practical physics course but I always had problems with fitting nonlinear functions to data. Currently I'd like to fit a gaussian function to my dataset. I tired several options including "FindFit" and "NonlinearModelFit" but the resulting function not even remotely resembles the curve of the original data. Sometimes the gaussian is centered around a very small, insignificant peak in my dataset but most frequently the height of the peak is way too small.
The attachment contains some data as an example. If plotted, the quite significant peak at the right end is what I am interested in.
For example I used the function FindFit with the following parameters:
FindFit[data,
A*1/(\[Sigma]*Sqrt[2 \[Pi]])
Exp[-(1/2) ((x - \[Mu])/\[Sigma])^2], {\[Sigma], \[Mu], A}, x]
The variable A obviously is used to scale the area under the curve. Even if I cut down all the data but the peak I want to fit the gaussian to, using
Take[data, {1700, 1990}]
I get values like
{\[Sigma] -> 1.74659, \[Mu] -> 2.29208, A -> 1628.23}
Which is obviously no good, considering the highest value in my data-list is 38635 and therefore bigger than A. (mu and sigma are also way off)
I have to stress, that to this point I have never learned how fitting to nonlinear data generally works. I taught myself how to work with Mathematica using the incredibly detailed and well designed documentation of Mathematica. It might be, that I misunderstand something at a very basic level.
Thanks in advance to the community :-)
Thomas
Attachments: