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

Home » Public Forums » archive » Re: Fitting an implicit function with IDL
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: Fitting an implicit function with IDL [message #71291] Wed, 09 June 2010 04:17
Gianluca Li Causi is currently offline  Gianluca Li Causi
Messages: 21
Registered: August 2005
Junior Member
>
> What I am not quite sure is how you include the data uncertainties in
> the model.


Dear Craig and Heinz,

in fact this is my problem: in the usual form F(x, A,B,C) = Y the data
uncertainties are on the right side, i.e. Y(x)+/-Err_Y(x), even if
Y=0, while in my case the data W(x) and Z(x) are within a functional
form which does not allow to isolate them on the right side.

In general if I have an equation F(x, Data(x) +/- Err_Data(x),
Params) = 0 and I try to write it as F +/- Err_F = 0, computing
Err_F as the error propagation of Err_Data through F, I get a
parameter-dependent uncertainty Err_F = Err_F(Params)!

This is why I cannot use CURVEFIT or the like (even MPFIT if I
understand). Can I?

Gianluca
Re: Fitting an implicit function with IDL [message #71302 is a reply to message #71291] Tue, 08 June 2010 16:47 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Jun 8, 6:54 am, Gianluca Li Causi <lica...@mporzio.astro.it> wrote:
> Hi all,
> I have to find the A, B and C parameters which best satisfy (in the
> chi-square sense) the following equation:
>
>    A * g(x) + (W(x) + B) / (X(x) + C) = 0
>
> where g(x) is a known function of x and (W +/- sigmaW) and (Z +/-
> sigmaZ) are two sets of measured data together with their measurement
> errors.
>
> This is different from the usual form F(x, A,B,C) = Y where a function
> of x and parameters is to be fitted to a dataset (Y +/- sigma_Y).
> So, how to use the various IDL fitting routines to solve this
> problem??

I think what you really want to use is the FORTRAN library ODRPACK.

As Heinz Stege said, you can use curve fitting programs as equation
solvers. I actually did an IDL workshop presentation on this very
type of application. [*]

What I am not quite sure is how you include the data uncertainties in
the model.

Craig

[*] http://cow.physics.wisc.edu/~craigm/idl/fitting.html
Re: Fitting an implicit function with IDL [message #71304 is a reply to message #71302] Tue, 08 June 2010 15:29 Go to previous message
Heinz Stege is currently offline  Heinz Stege
Messages: 189
Registered: January 2003
Senior Member
On Tue, 8 Jun 2010 03:54:18 -0700 (PDT), Gianluca Li Causi wrote:

> Hi all,
> I have to find the A, B and C parameters which best satisfy (in the
> chi-square sense) the following equation:
>
> A * g(x) + (W(x) + B) / (X(x) + C) = 0
>
> where g(x) is a known function of x and (W +/- sigmaW) and (Z +/-
> sigmaZ) are two sets of measured data together with their measurement
> errors.
>
> This is different from the usual form F(x, A,B,C) = Y where a function
> of x and parameters is to be fitted to a dataset (Y +/- sigma_Y).
> So, how to use the various IDL fitting routines to solve this
> problem??
>
I think, your equation is not really different from the form
y=f(x,A,B,C). In your case it is y=0. You can use the IDL fitting
routines by using an array y=fltarr(n_elements(x)). Possibly CURVEFIT
is your friend.

Greetings, Heinz
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: contour noise problem
Next Topic: IDL reading grib data on 64bit-machine

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

Current Time: Wed Oct 08 14:01:16 PDT 2025

Total time taken to generate the page: 0.01007 seconds