help-octave
[Top][All Lists]
Advanced

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

Re: Example in manual doesn't work?


From: Hermann Flaschka
Subject: Re: Example in manual doesn't work?
Date: Wed, 12 Sep 2007 15:32:55 -0700

Hi Thomas,

Yes, Octave wasn't running in its usual directory. Once I cd'd, lsode
worked fine.  I've caught such errors many times before, but not this
time. I'm sorry for the trouble.

Thanks
Hermann

On Sep 12, 2007, at 9:55 AM, Thomas Treichl wrote:

Hermann Flaschka schrieb:
Sorry, I meant to add that I am running OS X 10.4.10
on a MacBookPro.
Hermann

Hi Hermann,

I think that you've saved your file somewhere, where somewhere means it is not in your 'path'. Type 'pwd' in Octave and have a look where you currently are, type 'path' and have a look which paths are searched for *.m files, then 'cd' into the directory where your f.m is and run your example again. Or you can use the 'addpath' command to set up your path where f.m is placed. I can't see any problem running that example:

octave-2.9.13:2> function xdot=f(x,t)
xdot=zeros(3,1);
xdot(1)=77.27*(x(2)-x(1)*x(2)+x(1)-8.375e-06*x(1)^2);
xdot(2)=(x(3)-x(1)*x(2)-x(2))/77.27;
xdot(3)=0.161*(x(1)-x(3)); endfunction
octave-2.9.13:3> t=linspace(0,500,1000);
octave-2.9.13:4> x0=[4;1.1;4];
octave-2.9.13:5> y=lsode("f",x0,t);
octave-2.9.13:6> plot (t,y)

  Thomas




reply via email to

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