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 #32857 is a reply to message #32853] Tue, 12 November 2002 17:14 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
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.


> 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.

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]

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.

Good luck,
Craig

http://cow.physics.wisc.edu/~craigm/idl/idl.html (under curve fitting)

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[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: Mon Oct 27 05:15:20 PDT 2025

Total time taken to generate the page: 0.02907 seconds