"Ben" wrote in message <firstname.lastname@example.org>... > "Torsten" wrote in message <email@example.com>... > > > You fit the log of your data against the log of your fit function. > > This introduces a distortion to the estimates of your parameters. > > Why don't you try the direct way > > [bestfit,resid]=nlinfit(dp_data,N_data,norm_func,init_guesses); > > ? > > > > Best wishes > > Torsten. > > The reason why I used the log of my function is because of the reasons stated in the tutorial I linked to above (mainly that my function is not allowed negative values). I tried your suggestion, however, and the fit does look better but I'm still getting the same error message. Is there a way to restrict the allowed values for the parameters of nonlinfit? If anyone has any better suggestions for fitting a gaussian curve to this type of data, please let me know. I've been struggling with this for a while now.
Scale your N_data and your fit function by a common factor (e.g. 1e10). Then the error message should disappear.
I obtain quite a good fit for p(1)=1.95311e12 p(2)=2.85163e-8 p(3)=7.16019e-9