help-octave
[Top][All Lists]

## Re: passing values to function

 From: Heber Farnsworth Subject: Re: passing values to function Date: Tue, 28 Jan 2003 10:33:38 -0600

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
```
function y = f(x)
global A
y = (x/A**2)*exp(-x**2/(2*A**2))
endfunction

Then change the value of A at each stage of your loop.

Heber

On Tuesday, January 28, 2003, at 10:10 AM, Paolo Ariano wrote:

```
```hi * (all)

thanks for the suggestions on fitting, now i'm integrating a lot of data
in single files and i ought to write a int.ve to make it automatic but
at the moment i can't understand how to pass a value to a function
defined to be integrated:

at the moment i define the function and put the value that change for
every set of data (in this case is 0.051165):

function y = f (x)
y =(x/0.051165**2)*exp(-x**2/(2*0.051165**2)) ;
endfunction

and then

for i=1:columns(l)
[v(i)] = quad ("f", l(i), l(i+1));
endfor

i'd like to put all in a function but how to put the right function in
"f" and to pass the value as a variable ?

thanks a lot

probably is not so clear
paolo
--
Paolo Ariano
Neuroscience PhD Student
DBAU & INFM Turin (Italy)

La liberta' in coppia si dimezza -- Io

_____________________________________________________________________
For your security, this mail has been scanned and protected by Inflex

-------------------------------------------------------------
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
-------------------------------------------------------------

```
```

-------------------------------------------------------------
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
-------------------------------------------------------------

```