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: Thomas Treichl
Subject: Re: Example in manual doesn't work?
Date: Wed, 12 Sep 2007 18:55:06 +0200
User-agent: Thunderbird 2.0.0.6 (Macintosh/20070728)

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]