help-octave
[Top][All Lists]
Advanced

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

Example in manual doesn't work?


From: Hermann Flaschka
Subject: Example in manual doesn't work?
Date: Tue, 11 Sep 2007 22:22:44 -0700

Hello,

I could not get lsode to work, so I ran the example from the manual, as test.

===================
function xdot=f(x,t)     % saved as f.m

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:9> t=linspace(0,500,1000);
octave-2.9.13:10> x0=[4;1.1;4];
====================
Result:

octave-2.9.13:11> y=lsode("f",x0,t);
error: `f' undefined near line 1 column 42
error: evaluating assignment expression near line 1, column 40
error: called from `__lsode_fcn__n__'
error: lsode: evaluation of user-supplied function failed
error: lsode: inconsistent sizes for state and derivative vectors
=====================

This is the error message I get with my own functions.

Incidentally, t=linspace(0,500,1000) gives me
t(1:5)=0.00000   0.50050   1.00100   1.50150   2.00200

I don't understand why this should give me the time steps for the ODE solver.
=====================

What is going on?

Thanks,

Hermann Flaschka





















reply via email to

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