Problem with Parinfo on Craig Markwardt's MPFITPEAK [message #80662] |
Wed, 27 June 2012 06:07  |
Tito
Messages: 16 Registered: March 2012
|
Junior Member |
|
|
I am trying to fit Gaussians/Lorentzians with mpfitpeak on which I know the center, the amplitude and the Background offset and I want those 3 to be fixed and I am searching only the Sigma width. I tried this:
parinfo = replicate({value:0.0d, fixed:0, limited:[0,0], $
limits:[0.0d,0.0d]}, 4)
parinfo[0].fixed = 1b
parinfo[1].fixed = 1b
parinfo[2].limited[0] = 1b
parinfo[2].limits[0] = 0.005
parinfo[3].fixed = 1b
parinfo[*].value = [1.0d - stell_dep[i],xaxis[index[i]],0.005, 0.0]
y_fit2 = mpfitpeak(xaxis[minus2+ind:index[i] + ind2],$
1-spec[minus2+ind:index[i] + ind2],$
p2, parinfo = parinfo)
But this just is not working..... As I see it fix the center but all the rest of the parameters are not fixed and I have a terrible fit in the end.
Anybody know what I am doing wrong?
All the best!
Trifon
|
|
|
|
Re: Problem with Parinfo on Craig Markwardt's MPFITPEAK [message #80742 is a reply to message #80662] |
Fri, 29 June 2012 23:45  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Friday, June 29, 2012 10:08:09 AM UTC-5, alx wrote:
> On 29 juin, 11:44, Trifon Trifonov <tito_trifo...@abv.bg> wrote:
>> Anybody work with mpfitpeak?
>> I still can't figure out what I am doing wrong...
>
> I read in Craig's documentation:
>
> ESTIMATES - Array of starting values for each parameter of the
> ; model. (...) If ESTIMATES is not set,
> ; then the starting values are estimated from the data
> ; directly, before fitting. (This also means that
> ; PARINFO.VALUES is ignored.)
>
> alain.
Right. MPFITPEAK is a drop-in replacement for GAUSSFIT. For compatibility it honors the ESTIMATES keyword. Use that keyword.
Sorry about that. At least one other person has been tripped up by this.
Craig
|
|
|
Re: Problem with Parinfo on Craig Markwardt's MPFITPEAK [message #80746 is a reply to message #80662] |
Fri, 29 June 2012 08:08  |
lecacheux.alain
Messages: 325 Registered: January 2008
|
Senior Member |
|
|
On 29 juin, 11:44, Trifon Trifonov <tito_trifo...@abv.bg> wrote:
> Anybody work with mpfitpeak?
> I still can't figure out what I am doing wrong...
I read in Craig's documentation:
ESTIMATES - Array of starting values for each parameter of the
; model. (...) If ESTIMATES is not set,
; then the starting values are estimated from the data
; directly, before fitting. (This also means that
; PARINFO.VALUES is ignored.)
alain.
|
|
|
|