[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: phantom line error
From: |
roberto |
Subject: |
Re: phantom line error |
Date: |
Mon, 12 Sep 2005 12:48:17 +0200 |
On 9/12/05, Bill Denney <address@hidden> wrote:
> We need to see the script to be able to help you with the problem.
>
> On Mon, 12 Sep 2005, roberto wrote:
>
> > i'm running an octave script and today i got the following strange >>error:
> > ######
> > octave-2.1.69:52> E_X
> > parse error near line 58 of file
> > >>/home/roberto/NETs/temix/routing-temix/giacomo/packetostatic/MATLAB/Octave/E_X.m
> >
> > syntax error
> > #######
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [F_X] = F_X(x,r,R)
l = (0.1*sqrt(pi))*exp(-r^2 / 100);
F_X = 1 - exp(-l*area_x(x,R));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [area_x] = area_x(x,R)
%in our case the following holds
d = R;
a1 = R^2*acos((R^2+d^2-x^2)/(2*d*R));
a2 = x^2*acos((x^2+d^2-R^2)/(2*x*d));
s = 0.5*(R+x+d);
a3 = 2*sqrt(s*(s-R)*(s-x)*(s-d));
if (x >= d-R)&(x <= R)
area_x = a1+a2-a3;
elseif (x > R)
disp('x>R, not positive approach to destination');
return;
else
area_x = 0;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
also "wc -l" command on linux tells me that lines are two less than
octave opinion
--
roberto
debian sarge, kernel 2.6.8
-------------------------------------------------------------
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
-------------------------------------------------------------
- phantom line error, roberto, 2005/09/12
- Re: phantom line error, Bill Denney, 2005/09/12
- Re: phantom line error,
roberto <=
- Re: [sligthly OT] phantom line error, roberto, 2005/09/15
- Re: [sligthly OT] phantom line error, Shai Ayal, 2005/09/15
- Re: [sligthly OT] phantom line error, roberto, 2005/09/15
- Re: [sligthly OT] phantom line error, Henry F. Mollet, 2005/09/15
- Re: [sligthly OT] phantom line error, roberto, 2005/09/15
- Re: [sligthly OT] phantom line error, Shai Ayal, 2005/09/15
- Matlab primer (Was Re: [sligthly OT] phantom line error), Dmitri A. Sergatskov, 2005/09/15
- Re: [sligthly OT] phantom line error, Gerald Ebberink, 2005/09/15