[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fsolve over not all variables...
From: |
Andrey Romanenko |
Subject: |
Re: fsolve over not all variables... |
Date: |
Sat, 26 Feb 2005 23:38:50 +0000 |
User-agent: |
KMail/1.7.1 |
Hello,
On Saturday 26 February 2005 22:57, Gorazd Brumen wrote:
> How can I use fsolve so that it does not search over all
> parametrs of the function but only searches according to 1
> parameter? I have tried to define function with less
> parameters, but could not pass other parameters to it (global does
> not work)?
You have to define the parameters (P, ...) as "global":
global P;
P = 3;
...
in the main program (or where they are initialized) and in the objective
function as well.
This the following works for me:
--
function y=func(x)
global P;
y = P - 2*x;
endfunction;
global P;
P = 8;
res = fsolve("func", 10)
---
Andrey
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------