non linear systems, mpfitexpr and functargs [message #52361] |
Tue, 30 January 2007 10:15  |
Elix
Messages: 2 Registered: January 2007
|
Junior Member |
|
|
Hi,
in this newsgroup I found the interesting option of solving non-linear
systems using mpfitexpr. I need to use mpfitexpr with the functargs
keyword, but apparently I'm doing something wrong here.
stru={iref:iref,i2:i2}
p1=[0.3,0.5]
expr='[stru.iref-(1.-p[0])-p[0]*exp(-p[1]),'+$
'stru.i2-(1.-p[0])-p[0]*exp(-p[1]*0.3)]'
p=mpfitexpr(expr,0,0,1,p1,functargs=stru)
% MPFITEXPR: ERROR: execution of "[stru.iref-(1.-p[0])-p[0]*exp(-
p[1]),stru.i2-(1.-p[0])-p[0]*exp(-p[1]*0.3)]" failed.
Any suggestion?
thanks!
Elix
|
|
|
Re: non linear systems, mpfitexpr and functargs [message #52540 is a reply to message #52361] |
Sat, 03 February 2007 11:36  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
"Elix" <elisa.costantini@gmail.com> writes:
> in this newsgroup I found the interesting option of solving non-linear
> systems using mpfitexpr. I need to use mpfitexpr with the functargs
> keyword, but apparently I'm doing something wrong here.
>
> stru={iref:iref,i2:i2}
> p1=[0.3,0.5]
> expr='[stru.iref-(1.-p[0])-p[0]*exp(-p[1]),'+$
> 'stru.i2-(1.-p[0])-p[0]*exp(-p[1]*0.3)]'
> p=mpfitexpr(expr,0,0,1,p1,functargs=stru)
>
> % MPFITEXPR: ERROR: execution of "[stru.iref-(1.-p[0])-p[0]*exp(-
> p[1]),stru.i2-(1.-p[0])-p[0]*exp(-p[1]*0.3)]" failed.
Just a follow-up to this. You *can* use functargs to mpfitexpr, as
documented here:
; The most complicated optimization problems typically involve other
; external parameters, in addition to the fitted parameters. While
; it is extremely easy to rewrite an expression dynamically, in case
; one of the external parameters changes, the other possibility is to
; use the PRIVATE data structure.
Thus, you need to refer to your structure as PRIVATE, not stru.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|