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 #44437 is a reply to message #9041] Mon, 13 June 2005 14:50 Go to previous messageGo to previous message
kashyap is currently offline  kashyap
Messages: 26
Registered: April 1993
Junior Member
In article <1118691431.765056.244800@f14g2000cwb.googlegroups.com>,
<nolan.smith1@gmail.com> wrote:
> Hello,
>
> I am new in IDL and I am trying to fit my data (x,y coordinates) in a
> function of this form:
>
> y(x)=A/[(1+x/B)^1/2]^2
>
> so that I can calculate A and B.
>
> I have read the documentation but I am very confused as to how I should
> set up my function to use it at the curvefit.
> Could you please explain to me how to set up the function and how to
> use curvefit correctly?
>
> Thank you,
> Nolan Smith
>

Create a new procedure, say testfun.pro:

pro testfun,x,y,par,dfdpar
y=par[0]/((1+x/par[1])^(1./2.))^2
;question: why is this not y=par[0]/(1+x/par[1]) ?
dfdpar=fltarr(n_elements(x),2)
dfdpar[*,0]=y/par[0]
dfdpar[*,1]= {partial}y/{partial}B ..
;calculation left as an exercise for the reader!
return
end

and then call curvefit as
yfit=curvefit(x,y,weights,par,function_name='testfun')

vinay
--
____________________________________________________________ __________________
kashyap@head.cfa.harvard.edu 617 495 7173 [CfA/P-145] 617 496 7173 [F]
[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: Fri Oct 10 14:14:26 PDT 2025

Total time taken to generate the page: 0.80464 seconds