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

Home » Public Forums » archive » Curvefit
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: CURVEFIT [message #39642 is a reply to message #9041] Wed, 02 June 2004 11:40 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Andreas Ernst <aernst@ari.nis> writes:

> Hi,
>
> (1) I am using CURVEFIT to fit a straight line
> through my data points. My user-supplied
> function looks like this:
>
> PRO gerade, X, A, F, PDER
> F=A[0]+A[1]*X
> IF N_PARAMS() GE 4 THEN $
> PDER = [[REPLICATE(1.0, N_ELEMENTS(X))], [X]]
> RETURN
> END
>
> Anyway, even though it defines a straight line,
> the routine CURVEFIT seems to fit some other
> curve through the data points, which is something

A linear fit is trivial, and CURVEFIT shouldn't produce problems like
you found. My guess is that it is more likely that you have a data
handling problem. For example, if you perform a data selection on the
X values but forget to do the same for the Y values.

As the other poster said, you can use LINFIT/POLYFIT* to do the simple
fits you desire.

For more complicated fits, or as a cross check, you can use my own
fitting program, MPFIT + MPCURVEFIT, which have a wide acknowledgement
in the IDL community. As a combination, they are a drop-in
replacement for CURVEFIT (although if you don't have the requirement
to keep CURVEFIT compatibility, then I recommend using MPFITFUN).


Happy fitting!

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Locating IDL source code file
Next Topic: plotting data as it arrives using objects

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

Current Time: Sun Nov 30 02:35:19 PST 2025

Total time taken to generate the page: 0.00233 seconds