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

Home » Public Forums » archive » Re: What is the difference between 'curvefit', 'lmfit' and 'svdfit' procudure?
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: What is the difference between 'curvefit', 'lmfit' and 'svdfit' procudure? [message #52910 is a reply to message #52899] Wed, 07 March 2007 07:02 Go to previous messageGo to previous message
news.qwest.net is currently offline  news.qwest.net
Messages: 137
Registered: September 2005
Senior Member
<duxiyu@gmail.com> wrote in message
news:1173260085.952428.100150@q40g2000cwq.googlegroups.com.. .
> I have a set of 'x' and 'y', and want to use a special function 'f(x)'
> to fit it.
>
> The function 'f(x)' contains three parameters.
>
> But I'm confused by the three different procudure 'curvefit', 'lmfit'
> and 'svdfit'.

The difference is essentially between 1) linear least square error fits,
and 2) non-linear least square error fit.


In 1) you directly calculate the resulting fit.
You start with the matrix equation
Ax = b

where x is the unknown. 'A 'is a matrix where your
fitting function is evaluated at each point (and is usually
not square).

The LSF solution is:

A^tAx = A^tb
x = (A^tA)A^tb

The svd routines solve this matrix equation.

For 2) you make an error function
error = data - nonlinear function(x)

and you search around parameter space to try to
find the minimum error. This may not converge, it probably
depends on an initial guess, and can be very time consuming.
This is what curvefit and the others do.


If you can create a linear fit, then 1) is the way to go.
If it is non-linear, google fpr mpfit, widely hailed as a superior
non-linear fitting routine.
(i'll google: http://cow.physics.wisc.edu/~craigm/idl/idl.html)


Cheers,
bob
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: strange behaviour of ladfit - known?
Next Topic: using Container object for Strings?

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

Current Time: Sat Oct 11 10:15:29 PDT 2025

Total time taken to generate the page: 0.64074 seconds