Re: simultaneous fitting [message #56702] |
Sat, 10 November 2007 21:01  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
virgil1612@gmail.com writes:
> This is my first post here, so hi to everybody. As a disclaimer, I am
> a novice IDL user.
>
> I'm using LMFIT to make a chi square fitting of a function depending
> on some parameters to my data points, and it works great. But now the
> problem is that I need to simultaneously fit two functions depending
> on the same set of parameters to these points.
>
> I have no idea how to make the two functions simultaneous chi square
> fitting.
> Someone can help?
Fitting programs like LMFIT or MPFIT don't really care how many
functions you have. If you have two data sets Y1 and Y2, then you can
"glue" them together with a command like this,
Y = [Y1, Y2]
and in your model function, you would do the same thing, something
like,
F = [F1(X,P), F2(X,P)]
where F1() and F2() are your different functions, which are functions
of the same independent variable and the parameter set P.
Good luck,
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
|
|
Re: simultaneous fitting [message #56780 is a reply to message #56702] |
Mon, 12 November 2007 08:19  |
virgil1612
Messages: 3 Registered: November 2007
|
Junior Member |
|
|
To hradilv:
> You're going to have to reform the problem somehow, probably. Maybe
> you can give some more details?
So it's the same independent variable, values of x between 0 and 1
(phases of a binary star system, representing one complete orbit). I
have two columns of datapoints representing two separate variables,
that I need to simultaneously fit with two functions that are defined
with one common set of parameters. The fitting would give those
parameters.
to craig:
> Fitting programs like LMFIT or MPFIT don't really care how many
> functions you have. If you have two data sets Y1 and Y2, then you can
> "glue" them together with a command like this,
> Y = [Y1, Y2]
> and in your model function, you would do the same thing, something
> like,
> F = [F1(X,P), F2(X,P)]
> where F1() and F2() are your different functions, which are functions
> of the same independent variable and the parameter set P.
Thanks Craig, I'll try to do that.
Cheers, Virgil.
|
|
|