[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gaussfit question

David Fanning wrote:

>Why don't you continue on a bit and see if you
>get the result you expect.

Yes I did. I have the feeling it was more or less my fault.
>From my data it is clear that the centre of the gaussian should be
somewhere  in the middle between 0 an 36 which is not the case here for
Doing an 'oplot, x,yfit' gives a nice fit but not the right solution to
the problem (fitting a gaussian).

IDL> y=[52.0,52.7,56.0,60.9,65.40,71.40, 75.20,
101.3,97.2,92.1,87.4,87.0,82.5,77.4,69.9,67.7, 62.1, 58.9, 53.4,53.8]
IDL> x=findgen(37)
IDL> yfit=gaussfit(x,y,a)
% Program caused arithmetic error: Floating underflow
IDL> print,a
     -92.8950      38.7370      9.73786      48.4928
   4.97301   -0.0657729

Using the estimates keyword and removing the linear and quadratic term
results in the proper solution.

IDL> yfit=gaussfit(x,y,a, nterms=4,estimates=[90.0,20.0,10.0,10.0])
IDL> print,a
      96.7115      18.2423      13.4573      10.8630

without ESTIMATES the starting values for the fit seem not close enough

IDL> yfit=gaussfit(x,y,a, nterms=4)
% Program caused arithmetic error: Floating underflow
IDL> print,a
     -35.3286      35.3296      3.44060      89.3350

Therefore I think I have to supply estimates to GAUSS2DFIT() in the case I
like to fit an surface
because this routine uses GAUSSFIT().

Thanks for the help