[Top][All Lists]

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

problem with function

From: Anand
Subject: problem with function
Date: Thu, 11 Apr 2002 17:52:03 +0530 (IST)


I am a newbie to octave. I wrote a function findY.m (attached at the
end) in 2.1.35 which calculates y given x and other parameters passed as

I intend to call this function from a main program called beta.m
When I test it at the command line, it returns the correct value of y but
has some error/warning messages as shown :

>> findY (a, b, usd, lsd, 3.0)
warning: time stamp for
`/dsk1/student/anandss/PN2/Cprogs/Ver3/Octave/findY.m' is in the future
warning: near line 178, column 1:

>>> findY (a, b, usd, lsd, 3)

ans = 1.1344

Also, the function has only about 32 lines. Why am I getting an error on
line 177 ? I'd appreciate suggestions for writing functions.

I get similar error/warnings when called from the main program.


--------------------------- Function -------------------------------
function y = findY (a,b,usd,lsd,x)

if (nargin == 5)

 for i=301:451
   BCx(i-300) = a(i);
   BCy(i-300) = b(i);
   ACx(i-300) = a(i-300);
   ACy(i-300) = b(i-300);
   ABx(i-300) = a(i-150);
   ABy(i-300) = b(i-150);

 bcx = usd(:,2);
 bcy = usd(:,3);

 if x >= 4.85
   XX = ACx;
   YY = ACy;
 elseif x<= 2.85
   XX = ABx;
   YY = ABy;
   XX = bcx;
   YY = bcy;


y = spline(XX,YY,x);


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]