help-octave
[Top][All Lists]
Advanced

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

Re: [sligthly OT] phantom line error


From: Gerald Ebberink
Subject: Re: [sligthly OT] phantom line error
Date: Thu, 15 Sep 2005 14:24:42 +0200
User-agent: Mozilla Thunderbird 1.0 (X11/20041207)

Sorry I forgot to include the list:

Hi roberto,

the fact that you do not see the variables, is becouse you don't exactly have a script. What you have is an function (hence the word function at the begining). In a function all variables are "destroyed" after the return value is returned.

roberto wrote:
On 9/12/05, roberto <address@hidden> wrote:
here is the script

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function[E_X] = E_X(R)

% R = trasmission radius
% r = distance from destination
% uses 1000 points to integrate

r = linspace(R,10,10);
A = zeros(1,R);
for j = R:length(r)
       x = linspace(0,R,10);
       n = length(x);
       delta = R/n;
       for i = 1:n
               if ((i-1)*delta) < 0
                       F_int(i) = 0;
               elseif ((i-1)*delta) > R
                       F_int(i) = 1;
               else
                       F_int(i) = F_X((i-1)*delta,r(j),R);
       end
       A(j)   = sum(F_int)*delta;
       E_X(j) = R - A(j);
end

save E_X_ E_X
% for Octave-to-MATLAB compatibility
save -mat E_X_mat E_X

i have also another question for you about this code:
if i run it and then i type at the octave prompt something like:
octave2.1:10>r
error: `r' undefined near line 10 column 1

also if i take a look at:
octave2.1:11>whos
*** currently compiled functions:

 Prot Name        Size                     Bytes  Class
 ==== ====        ====                     =====  =====
  rwd E_X        -1x-1                         0  user-defined function
  rwd F_X        -1x-1                         0  user-defined function
  rwd area_x     -1x-1                         0  user-defined function

Total is 3 elements using 0 bytes

*** local user variables:

 Prot Name            Size                     Bytes  Class
 ==== ====            ====                     =====  =====
  rw- __nargin__      1x1                          8  scalar

Total is 1 element using 8 bytes

then i cannot see anything regarding the variables i defined inside the script;
but i do not understand why; i can not even retrieve the values
interesting for my calculation...

thak you about any help

--
roberto
debian sarge



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



--
Ing. ing. Gerald Ebberink
Research Technician

Kernfysisch Versneller Instituut
Rijksuniversiteit Groningen
Zernikelaan 25
9747 AA Groningen
The Netherlands
tel: +31 50 363 3518
lab: +31 50 363 3588
mob: +31 61 644 4242
fax: +31 50 363 4003



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



reply via email to

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