From owner-help-octave at bevo dot che dot wisc dot edu Tue Oct 29 06:39:11 1996 Subject: Re: Sending parameters to FSOLVE? From: Mario Storti To: help-octave at bevo dot che dot wisc dot edu Date: Tue, 29 Oct 1996 09:42:01 -0300 >>>>> On Tue, 29 Oct 96 14:17:32 +0100, "Bernt Nilsson" said: :> Hello all, Is there a way to send parameters to FSOLVE like there :> is in MATLAB (i.e. fsolve('func',...,p1,p2,p3...))? :> It is a bit awkward to rewrite the m-file func.m everytime I want :> to call it with a different value for a parameter. :> Thanks for any input on this! :> Sincerely, Bernt :> Bernt J Nilsson email : berntn at sto dot foa dot se FOA, Inst. 65 tel : +46 8 :> 706 3611 S-172 90 Stockholm, Sweden FAX : +46 8 706 3543 >From the info documentation, I don't see that you can pass arguments that way, but you can send parameters declaring them as "global". For instance: ===================================================== # This is the main code (...) # declaring my_internal_parameter as global global my_internal_parameter my_internal_parameter=0.001; (...) solution=fsolve("my_residual",... (...) function my_residual(x) # The global declaration must be present also in the called function global my_internal_parameter # I can use "my_internal_parameter" even if it's not passed as # argument! :-) f=my_internal_parameter; endfunction ======================================================== Hope this helps Mario %%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%% Mario Alberto Storti | Fax: (54)(42) 55.09.44 | Grupo de Tecnologia Mecanica | Tel: (54)(42) 55.91.75 | INTEC, Guemes 3450 - 3000 Santa Fe | http://venus.unl.edu.ar/gtm-eng.html | Argentina | Home: Gob. Vera 3161 | Reply: mstorti at galileo dot unl dot edu dot ar| | (54)(42) 55 dot 00 dot 23 | (54)(42) 55.00.23 |