global variables in functions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

global variables in functions

Francesco Potorti`-7
Hi, I am a new octave user.

Isn't there any way of using an external (i.e. non local) variable in
a function?

A related question that has led me to the previous one: if I have a
function f() and want to make an array of the values of the inverse
function, how can I do?  I tried making an array x[] of numbers and
finding the zeroes of f(x)==x[i] for every i using the fsolve
function, but failed because I could not put fsolve inside a loop in
order to fill an array y[] because I could not use the nonlocal
variable i in the function F(x)=f(x)-x[i] that I gave to fsolve.

Thanks for caring.
Please answer to me directly, as my subscription to the list has not
yet been acknowledged.
            Francesco Potorti` | [hidden email] (Internet)
                          | 39369::pot (DECnet)
                                | +39-50-593203 (voice) 589354(fax)