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

Home » Public Forums » archive » Re: simultaneous fitting
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: simultaneous fitting [message #56702] Sat, 10 November 2007 21:01 Go to next message
Craig Markwardt is currently offline  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 #56711 is a reply to message #56702] Sat, 10 November 2007 11:07 Go to previous messageGo to next message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Nov 9, 3:20 pm, virgil1...@gmail.com wrote:
> Sorry, I made a mistake. I have two sets of points for the two
> functions, of course (the functions are different). What remains
> unchanged is the set of parameters and the independent variable.
>
> Thanks, Virgil.

You're going to have to reform the problem somehow, probably. Maybe
you can give some more details?
Re: simultaneous fitting [message #56716 is a reply to message #56711] Fri, 09 November 2007 13:20 Go to previous messageGo to next message
virgil1612 is currently offline  virgil1612
Messages: 3
Registered: November 2007
Junior Member
Sorry, I made a mistake. I have two sets of points for the two
functions, of course (the functions are different). What remains
unchanged is the set of parameters and the independent variable.

Thanks, Virgil.
Re: simultaneous fitting [message #56780 is a reply to message #56702] Mon, 12 November 2007 08:19 Go to previous message
virgil1612 is currently offline  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.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: icontour scaling color table
Next Topic: iplot polar troubles

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

Current Time: Fri Oct 10 21:53:30 PDT 2025

Total time taken to generate the page: 0.47960 seconds