HELP NEEDED! to fit a linear equation containing 2 independant variables [message #48943] |
Thu, 08 June 2006 10:17  |
antoine.dlc
Messages: 1 Registered: June 2006
|
Junior Member |
|
|
Dear fellow IDL programmers,
I'm trying to fit the parameters of a linear equation of type:
z = a*x + b*y + c
where a, b,c are constant parameters and x,y are two independant
variables.
In the past, I used the procedures LMFIT, LINFIT, CURVEFIT to fit
equations but these only accept 1 independant variable.
Can someone tell me if a procedure exists to fit the parameters of a
linear equation made of 2 independant variables???
If not, is it possible to give LMFIT, LINFIT, CURVEFIT...etc. 2
independant variables instead of only 1?
Thanks a lot !!!
Tony
|
|
|
Re: HELP NEEDED! to fit a linear equation containing 2 independant variables [message #48996 is a reply to message #48943] |
Sun, 11 June 2006 00:14  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
antoine.dlc@gmail.com writes:
> Dear fellow IDL programmers,
>
> I'm trying to fit the parameters of a linear equation of type:
>
> z = a*x + b*y + c
>
> where a, b,c are constant parameters and x,y are two independant
> variables.
>
> In the past, I used the procedures LMFIT, LINFIT, CURVEFIT to fit
> equations but these only accept 1 independant variable.
>
> Can someone tell me if a procedure exists to fit the parameters of a
> linear equation made of 2 independant variables???
>
> If not, is it possible to give LMFIT, LINFIT, CURVEFIT...etc. 2
> independant variables instead of only 1?
Actually LMFIT and CURVEFIT *can* accept multiple variables. If you
read the documentation,
; X: A row vector of independent variables. This routine does
; not manipulate or use values in X, it simply passes X
; to the user-written function.
you can define any "X" vector that you wish as long as it is a single
IDL variable. It could be a structure containing X and Y, or a
concatenated vector of [X, Y] values. Either way, it is up to your
model function to retreive the proper X and Y values from the combined
variable.
Happy fitting,
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: HELP NEEDED! to fit a linear equation containing 2 independant variables [message #49040 is a reply to message #48943] |
Thu, 08 June 2006 13:10  |
Brian Larsen
Messages: 270 Registered: June 2006
|
Senior Member |
|
|
Tony,
this is exactly what the regress function in idl does. Have a look at
its help page.
Cheers,
Brian
antoine.dlc@gmail.com wrote:
> Dear fellow IDL programmers,
>
> I'm trying to fit the parameters of a linear equation of type:
>
> z = a*x + b*y + c
>
> where a, b,c are constant parameters and x,y are two independant
> variables.
>
> In the past, I used the procedures LMFIT, LINFIT, CURVEFIT to fit
> equations but these only accept 1 independant variable.
>
> Can someone tell me if a procedure exists to fit the parameters of a
> linear equation made of 2 independant variables???
>
> If not, is it possible to give LMFIT, LINFIT, CURVEFIT...etc. 2
> independant variables instead of only 1?
>
>
> Thanks a lot !!!
> Tony
|
|
|