comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » scattering data with MPFITFUN
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: scattering data with MPFITFUN [message #84987 is a reply to message #84968] Thu, 20 June 2013 12:00 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Thursday, June 20, 2013 4:23:27 AM UTC-4, Nafiseh Masoumzadeh wrote:
> On Thursday, June 20, 2013 5:51:16 AM UTC+2, Craig Markwardt wrote:
>> On Wednesday, June 19, 2013 6:49:43 PM UTC-4, Nafiseh Masoumzadeh wrote:
>>
>>> Hello,
>>>
>>> I have some data which I simply want to fit p[0]*x^P[1] on them, But
>>> I don't know I am receiving very far results!
>>> I am using mpfitfun like this:
>>> start=[0.001, 0.1]
>>> results=MPFITFUN('MYFUNCTION', x, y, err, start)
>>>
>>> I applied this function and points in MATLAB (fitting toolbox) , and I had reasonable coefficients .
>> MPFITFUN can solve problems like this.
>>
>> What happens when you say,
>> YMODEL = MYFUNCTION(X, START)
>> Do you get sensible values for YMODEL?
>> You should also be checking the STATUS and ERRMSG keywords to see if there is a more informative error message.
>
> yes, I got reasonable result from YMODEL. and for STATUS I got 6 and I don't have any ERRMSG. I checked in MPFIT script that 6 for STATUS means
>
> FTOL is too small. no further reduction in
> ; the sum of squares is possible.
>
> but I cannot figure out what is the problem?

STATUS=6 is not necessarily a good or bad thing. It usually means that a best fit was achieved.

So let's assume the results of the IDL fit are RESULTS_IDL and the results from your Matlab fit are RESULTS_MATLAB. You can then compute the chi-square value for each.

CHI_START = TOTAL( (MYFUNCTION(X, START) - Y)^2 / ERROR^2 )

CHI_IDL = TOTAL( (MYFUNCTION(X, RESULTS_IDL) - Y)^2 / ERROR^2 )

CHI_MATLAB = TOTAL( (MYFUNCTION(X, RESULTS_MATLAB) - Y)^2 / ERROR^2 )

How different are these three values?

Craig
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: National Hiking Day
Next Topic: Avoiding Loops in IDL 8.2.2

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 14:53:46 PDT 2025

Total time taken to generate the page: 1.68164 seconds