Re: Fitting an implicit function with IDL [message #71291] |
Wed, 09 June 2010 04:17 |
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  |
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  |
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
|
|
|