gaussfit question [message #17552] |
Fri, 29 October 1999 00:00  |
mirko[1]
Messages: 3 Registered: October 1999
|
Junior Member |
|
|
Hi!
I have a 2D dataset representing a surface (intensity plot of x-ray
scattering data)
and i like to fit these data with GAUSS2DFIT() function which does not work.
So I tried to fit one line of the dataset wit GAUSSFIT which does not
work either.
This it is confusing to me because other math computer programs
have no problem with this simple curve.
Is there something I have to consider?
Cheers
Mirko
IDL> y=[52.0,52.7,56.0,60.9,65.40,71.40, 75.20,
80.80,86.1,89.8,88.3,94.8,94.9,100.5,100.1,103.9,105.3,106.2 ,107.3,
108.2,106.1,105.7,107.8,102.2,
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)
% Compiled module: GAUSSFIT.
% Compiled module: POLY_FIT.
% Compiled module: CURVEFIT.
% Program caused arithmetic error: Floating underflow
|
|
|
Re: gaussfit question [message #17610 is a reply to message #17552] |
Mon, 01 November 1999 00:00  |
mirko[1]
Messages: 3 Registered: October 1999
|
Junior Member |
|
|
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
a[1].
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,
80.80,86.1,89.8,88.3,94.8,94.9,100.5,100.1,103.9,105.3,106.2 ,107.3,
108.2,106.1,105.7,107.8,102.2,
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
Mirko
|
|
|
Re: gaussfit question [message #17614 is a reply to message #17552] |
Mon, 01 November 1999 00:00  |
<karri
Messages: 4 Registered: October 1999
|
Junior Member |
|
|
I got tired about these "Your program has an arithmetic
underflow"-messages and reported them to RSI.
They will remove them from version 5.3.
You can see this error message by writing
a=fft(shift(complexarr(128),0))
The message is complete nonsense. Try writing this
procedure:
pro t
a=complexarr(128)
a=shift(a,0)
a=fft(a)
end
It will produce the same underflow error.
Now run it by typing it one line at a time.
Voila! No error message.
--
Regards,
Karri Kaksonen
|
|
|