[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Gauss2DFit question
"K. Bowman" <k-bowman@null.tamu.edu> writes:
> I'm trying to use the library routine GAUSS2DFIT to fit some smooth,
> blobby functions. My experience so far has been ... ah ... suboptimal.
> It does not converge quickly or well.
>
> Example (modified from the example in the manual):
>
...
> yfit = GAUSS2DFIT(z, b, /TILT) ;Fit the function
...
I hope you try MPFIT2DPEAK, which is a drop-in replacement for
GAUSS2DFIT, but is based on the MINPACK-1 family of more robust
fitting routines at my website. The only change I make was to the
function name, otherwise the invocation is the same:
yfit = MPFIT2DPEAK(z,b,/tilt)
MPFIT2DPEAK also has some other cool peak-like functions, and has all
the standard MPFIT-family bells and whistles. Of course you will need
to download MPFIT & MPFIT2DFUN, the service routines that make it go.
http://cow.physics.wisc.edu/~craigm/idl/idl.html
These are the results I got, much closer to what you probably want:
Should be: 5.0000 10.0000 21.3333 10.0000 64.0000 60.0000 0.7854
Is: : 5.0089 10.0095 21.3838 9.9872 64.0621 59.9459 0.7790
Alas, it took a little longer, but my philosophy is slower and right
is better than faster and wrong.
I should also mention that determining the parameters of a peak can be
pretty hard to do automatically, especially when noise is present. I
believe the approach implemented in MPFIT2DPEAK is actually quite a
bit more robust than that of GAUSS2DFIT, but still, it cannot be
perfect.
If you can, I strongly recommend supplying starting values that match
your problem. For example, if you know where the peak is roughly, or
the width of the peak, that can really help the peak finding process.
Good luck!
Craig
--
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------