From help-octave-request at bevo dot che dot wisc dot edu Fri Jan 31 10:29:52 2003 Subject: Re: passing values to function From: Heber Farnsworth To: Paolo Ariano Cc: help-octave at bevo dot che dot wisc dot edu 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)); endfunction Heber > > but nothing. :( > > thanks a lot > paolo > > ------------------------------------------------------------- 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 -------------------------------------------------------------