[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: passing values to function

From: Heber Farnsworth
Subject: Re: passing values to function
Date: 31 Jan 2003 10:29:45 -0600

On Fri, 2003-01-31 at 09:25, Paolo Ariano wrote:
> Il mar, 2003-01-28 alle 17:33, Heber Farnsworth ha scritto: 
> > If I understand your problem correctly then the best way to solve it is 
> > to define a global variable A and write you function as
> sorry but i don't understand, i was reading also the octave manual but
> how to pass a global variable to a function:
> here i define a global varable A:
> svx = (std(mat(3,:)))^2;
> svy = (std(mat(4,:)))^2;
> global A=(sqrt((svx+svy)/2))    
> here i define the function and i try to pass the global variable A to
> this function but probably there is a big mistake:
> function y = f (x,A)  
> y =(x/A**2)*exp(-x**2/(2*A**2));
> endfunction

Write your function this way

function y = f(x)
global A
y = (x/A**2)*exp(-x**2/(2*A**2));


> but nothing. :(
> thanks a lot
> paolo

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]