|
From: | dastew |
Subject: | RE: fsolve and parameter dependent functions |
Date: | Wed, 10 Jun 2009 16:11:49 +0000 |
> Date: Wed, 10 Jun 2009 15:25:39 +0100 > From: address@hidden > To: address@hidden > Subject: fsolve and parameter dependent functions > > Say I have a function set up like this; > > function y = f(x) > ... stuff ... > endfunction > > Then I can call fsolve("f",init) with init specifying initial > conditions. And it works really nicely. > > However what if the function is to include a parameter, > > function y = f(x,p) > ... stuff ... > endfunction > > I want to specify p *when I call* fsolve. Is this possible? One > could conceivably pass p through initial conditions and treat it as a > variable, however I don't want to do this! Is there a cleaner way to > do it? > > Thanks! > > Take a look at global variables, they are the way to do this. Just a heads up note here: you must declare a global variable as gloabal in your "main" area and in your "function" area -- both places. Doug |
[Prev in Thread] | Current Thread | [Next in Thread] |