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

Home » Public Forums » archive » non linear systems, mpfitexpr and functargs
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
non linear systems, mpfitexpr and functargs [message #52361] Tue, 30 January 2007 10:15 Go to next message
Elix is currently offline  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 Go to previous message
Craig Markwardt is currently offline  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
------------------------------------------------------------ --------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: using LOCATIONS keyword of IDLgrText?
Next Topic: Re: .sav format

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

Current Time: Wed Oct 08 19:02:05 PDT 2025

Total time taken to generate the page: 0.00430 seconds