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

Home » Public Forums » archive » Re: curvefit question
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
Re: curvefit question [message #25745] Thu, 12 July 2001 08:14
R.G.S. is currently offline  R.G.S.
Messages: 46
Registered: September 2000
Member
Mike Barker <animals@wam.umd.edu> wrote in message
news:Pine.GSO.4.21.0107111818550.4496-100000@rac4.wam.umd.ed u...
> Hello,
>
> I would like to fit the following function:
>
> y = m2*(x - x0) + m1*x0 + b1
>
> where m2 is the ONLY parameter to be fitted and m1, b1, x0 are
> variables (I DO NOT want to fit them). I'm having trouble figuring out
> how to do this with curvefit (or any of the other built-in
> routines). Curvefit won't let me pass m1, b1, and x0 as parameters. I
> tried using a common block to store the variables but I still have to
> compile the function before I declare the common block. If anyone could
> help I would be forever grateful.
>
> Sincerely,
> Mike
>

This is a BC answer (before coffee) so take it for what
its worth:

fit to
g = y - m1*x0-b1 = m2(x-x0)

hey, also change variables to (x' = x-x0)


Cheers,
bob stockwell
Re: curvefit question [message #25754 is a reply to message #25745] Wed, 11 July 2001 22:10 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
david@dfanning.com (David Fanning) writes:
> Before I went to all that trouble I'd hot-foot it over
> to Craig's web page and get something better than
> CURVEFIT.
>
> http://cow.physics.wisc.edu/~craigm/idl/fitting.html

Heck, I'll agree with David on this one :-)

Mike, you'll want to check out the PARINFO keyword, and in particular
the facility to set parameters to be FIXED. Or, if you are perhaps
lazier, you can simply pass your unchanging parameters as keywords
using FUNCTARGS as Vinay described.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: curvefit question [message #25758 is a reply to message #25754] Wed, 11 July 2001 15:54 Go to previous message
david[2] is currently offline  david[2]
Messages: 100
Registered: June 2001
Senior Member
Vinay L. Kashyap writes:

> Best edit CURVEFIT.PRO to include _EXTRA=E as keyword to all
> calls to CALL_PROCEDURE inside it (and also to the function
> definition!), then pass m1,b1,x0 as keywords to your program.

Before I went to all that trouble I'd hot-foot it over
to Craig's web page and get something better than
CURVEFIT.

http://cow.physics.wisc.edu/~craigm/idl/fitting.html

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: curvefit question [message #25760 is a reply to message #25758] Wed, 11 July 2001 16:50 Go to previous message
kashyap is currently offline  kashyap
Messages: 26
Registered: April 1993
Junior Member
Best edit CURVEFIT.PRO to include _EXTRA=E as keyword to all
calls to CALL_PROCEDURE inside it (and also to the function
definition!), then pass m1,b1,x0 as keywords to your program.

vinay

In article <Pine.GSO.4.21.0107111818550.4496-100000@rac4.wam.umd.edu>,
Mike Barker <animals@wam.umd.edu> wrote:
> Hello,
>
> I would like to fit the following function:
>
> y = m2*(x - x0) + m1*x0 + b1
>
> where m2 is the ONLY parameter to be fitted and m1, b1, x0 are
> variables (I DO NOT want to fit them). I'm having trouble figuring out
> how to do this with curvefit (or any of the other built-in
> routines). Curvefit won't let me pass m1, b1, and x0 as parameters. I
> tried using a common block to store the variables but I still have to
> compile the function before I declare the common block. If anyone could
> help I would be forever grateful.
>
> Sincerely,
> Mike
--
____________________________________________________________ __________________
kashyap@head-cfa.harvard.edu 617 495 7173 [CfA/P-146] 617 496 7173 [F]
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Events in IDLDrawWidget
Next Topic: Easy way to do superscripts, greek letters, etc.?

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

Current Time: Wed Oct 08 14:52:37 PDT 2025

Total time taken to generate the page: 0.00449 seconds