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

Home » Public Forums » archive » help with curve fitting
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
help with curve fitting [message #85434] Sat, 03 August 2013 16:29 Go to next message
paulartcoelho is currently offline  paulartcoelho
Messages: 30
Registered: March 2007
Member
hello,

i'm trying to use idl to fit (x,y) data using MPFIT by C. Markwardt. This is my first time doing curve fitting with IDL. I need to fit an exponential function of the form:

y = p[0]*(p[1]^(x/p[2]))+p[3]

which I empirically found to be a good fit to the data (by eye, plotting the data and overploting the function with some parameter guesses). By eye as well I sorted out good first guesses (don't know if i can attach a picture here). Nevertheless, I can't make it fit:

IDL> print,expr
P[0]*(p[1]^(x/p[2]))+p[3]
IDL> print,start
4.00000 -0.870000 180.000 1.00000
IDL> result=mpfitexpr(expr,l,f,1,start)
Iter 1 CHI-SQUARE = -NaN
P(0) = 4.00000
P(1) = -0.870000
P(2) = 180.000
P(3) = 1.00000
% MPFITEXPR: ERROR: parameter or function value(s) have become infinite; check model function for
over- and underflow
% Program caused arithmetic error: Floating illegal operand

Could someone point me out in the direction to solve this? Plotting the function with the same parameters and datasets do not generate any under- overflow error.

many thx
paula
Re: help with curve fitting [message #85435 is a reply to message #85434] Mon, 05 August 2013 18:02 Go to previous message
paulartcoelho is currently offline  paulartcoelho
Messages: 30
Registered: March 2007
Member
never mind, the initial parameters were producing complex numbers.

it should have been
start=[-4.,0.87,180.,1.].

i wonder how IDL plots complex numbers without complaining... :)

p.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Best methods for finding a threshold edge, like a coastline?
Next Topic: Poly_Fit

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

Current Time: Wed Oct 08 15:21:15 PDT 2025

Total time taken to generate the page: 0.00611 seconds