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

Home » Public Forums » archive » Re: Problems getting CURVEFIT to work
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: Problems getting CURVEFIT to work [message #32853 is a reply to message #32849] Tue, 12 November 2002 23:43 Go to previous messageGo to previous message
Jonathan Greenberg is currently offline  Jonathan Greenberg
Messages: 91
Registered: November 2002
Member
Thanks!

On 11/12/02 5:14 PM, in article onk7jiuv7e.fsf@cow.physics.wisc.edu, "Craig
Markwardt" <craigmnet@cow.physics.wisc.edu> wrote:

>
> Jonathan Greenberg <greenberg@ucdavis.edu> writes:
>> Hi there, I'm trying to use CURVEFIT to fit data to a decay function of the
>> form:
>> f(x) = a(1-e^(bx))+c
>
> Problem 1. Your parameters A and C are very highly (anti) correlated
> with each other. It would be better to recast as A*EXP(B*X) + C.

The problem is I need a curve that starts low and asymptotes higher -- I
have a reason to believe it will asymptote at some maximum, hence the
a(1-e^(bx))+c --> given this, how can I get this to work?

>
>
>> My code is as follows:
>>
>> pro decayfunc, X,A,F,pder
>> bx=EXP(A[1]*X)
>> F=A[0]*(1-bx)+A[2]
>> if N_PARAMS() GE 4 THEN $
>> pder=[[1-bx],[-A[0]*X*bx],[replicate(1.0,N_ELEMENTS(X))]]
>> end
>> X=[30185.0,33897.0,35089.0,35377.0,35665.0]
>> Y=[0.3002,1.3849,1.3004,1.226,1.3118]
>> A=[1.25,-1.0,-0.1]
>
> Problem 2. Your initial value of "B" of -1 is not a good choice.
> When the fitter tries to evaluate EXP(-1.0*30185.) the result is zero.
> A better choice would be about -1./30000.

I'll try that out!

>
> Problem 3. Your data don't look very exponential to me! There is
> just one low point. You are going to have to live with some very
> large confidence intervals...
>
>> weight=[1.0,1.0,1.0,1.0,1.0]
>> yfit=CURVEFIT[X,Y,weights,A,SIGMA,FUNCTION_NAME='decayfunc', /DOUBLE]

Yeah, I have more data now, and will try this!

>
> Suggestion. It might be worth trying MPCURVEFIT or MPFITFUN from my
> web page. The fitting routines appear to be much more robust than the
> stock CURVEFIT.

I'll try them. Thanks!

>
> Good luck,
> Craig
>
> http://cow.physics.wisc.edu/~craigm/idl/idl.html (under curve fitting)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Updated Display
Next Topic: MPCURVEFIT and CURVEFIT questions

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

Current Time: Sun Oct 12 07:14:12 PDT 2025

Total time taken to generate the page: 0.48156 seconds