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

Home » Public Forums » archive » Curvefit issues
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
Curvefit issues [message #48198] Thu, 06 April 2006 15:16 Go to next message
vorticitywolfe is currently offline  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 Go to previous message
Craig Markwardt is currently offline  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 #48325 is a reply to message #48198] Fri, 07 April 2006 09:23 Go to previous message
vorticitywolfe is currently offline  vorticitywolfe
Messages: 19
Registered: January 2006
Junior Member
Thanks Ben,

The /noderivative worked. Wish the manual was a little more explicit
on this function. Thanks again!

Jon
Re: Curvefit issues [message #48333 is a reply to message #48198] Fri, 07 April 2006 00:51 Go to previous message
Benjamin Luethi is currently offline  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
>



--
-------------+
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Shift (floating point version)
Next Topic: 2D to 3D Array

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

Current Time: Wed Oct 08 15:39:18 PDT 2025

Total time taken to generate the page: 0.00591 seconds