help with curve fitting [message #85434] |
Sat, 03 August 2013 16:29  |
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
|
|
|
|