Curvefit issues [message #48198] |
Thu, 06 April 2006 15:16  |
vorticitywolfe
Messages: 19 Registered: January 2006
|
Junior Member |
|
|
Hello,
I'm trying to fit a simple 1 parameter function to this data (see below
A,B); however, I am getting an error message " % GFUNCT: Incorrect
number of arguments." What's going on? It seems trivial, but I don' see
where it is faltering. Thanks for the help!
Jon
;*********************************************************** ******
pro test
A=[0.910000, 0.460000, 0.870000,0.740000]
B=[4.46684,1.99526,28.1838, 11.2202]
weights = A
weights(*) = 1.0
;Provide an initial guess of the function's parameters.
G = 300.0
;Compute the parameters.
fit = CURVEFIT(A, B, weights, G, FUNCTION_NAME='gfunct')
PRINT, 'Function parameters: ', G
END
PRO gfunct, A, G, F
F = G * A^(2.0)
end
|
|
|
Re: Curvefit issues [message #48323 is a reply to message #48198] |
Fri, 07 April 2006 10:56  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
"Jonathan Wolfe" <vorticitywolfe@gmail.com> writes:
> Thanks Ben,
>
> The /noderivative worked. Wish the manual was a little more explicit
> on this function. Thanks again!
Let me toot my own horn here and recommend that you give my MPFIT
package a try. It's lots more robust than CURVEFIT. You can drop in
MPCURVEFIT as a replacement for CURVEFIT, but there are other fit
drivers too.
Craig
See http://cow.physics.wisc.edu/~craigm/idl/
under Curve Fitting
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
|
Re: Curvefit issues [message #48333 is a reply to message #48198] |
Fri, 07 April 2006 00:51  |
Benjamin Luethi
Messages: 22 Registered: December 2004
|
Junior Member |
|
|
Hi,
CURVEFIT assumes that gfunct provides the derivative as well.
Either program it in gfunct or use CURVEFIT with the /NODERIVATIVE option.
Ben
On Fri, 07 Apr 2006 00:16:30 +0200, Jonathan Wolfe
<vorticitywolfe@gmail.com> wrote:
> Hello,
>
> I'm trying to fit a simple 1 parameter function to this data (see below
> A,B); however, I am getting an error message " % GFUNCT: Incorrect
> number of arguments." What's going on? It seems trivial, but I don' see
> where it is faltering. Thanks for the help!
>
> Jon
> ;*********************************************************** ******
> pro test
>
> A=[0.910000, 0.460000, 0.870000,0.740000]
> B=[4.46684,1.99526,28.1838, 11.2202]
>
> weights = A
> weights(*) = 1.0
>
> ;Provide an initial guess of the function's parameters.
> G = 300.0
>
> ;Compute the parameters.
> fit = CURVEFIT(A, B, weights, G, FUNCTION_NAME='gfunct')
>
> PRINT, 'Function parameters: ', G
> END
>
> PRO gfunct, A, G, F
> F = G * A^(2.0)
> end
>
--
-------------+
|
|
|