help-octave
[Top][All Lists]
Advanced

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

moving from matlab to octave


From: Jeff Sadowski
Subject: moving from matlab to octave
Date: Fri, 21 Feb 2003 12:46:08 -0700 (MST)

I am new to using these applications and I really
don't understand exactly what I'm doing in either.

I have a matlab project that looks like this.
file vdpol.m contains
function xdot=vdpol(t,x)
beta=5.0;
omega=1.5;
xdot=[x(2);x(2).*(1-x(1)*x(1))-x(1) + beta*cos(x(3));omega];

supposidly this means
dx_sub1/dt=x_sub2
dx_sub2/dt=x_sub2((1-x_sub1)^2)-x_sub1+beta*cos(x_sub3)
dx_sub3/dt=omega

then I enter matlab and run this

tspan=[0,20]
x0=[1.0,0.0,2.0];
[t,x]=ode45('vdpol',tspan,x0);
x1=x(:,1)
plot(t,x1)

when I try it in octavelike this

tspan=[0,20]
x0=[1.0,0.0,2.0];
[t,x]=lsode('vdpol',tspan,x0);

I get the improper usage of lsode message

if I try
y=lsode('vdpol',tspan,x0);

I get

error: invalid vector index = 2
error: evaluating index expression near line 4, column 9
error: evaluating assignment expression near line 4, column 6
error: called from `vdpol' in file `/home/guest/math316/vdpol.m'
error: lsode: evaluation of user-supplied function failed
error: lsode: inconsistent sizes for state and derivative vectors

I'm not sure what this even means any help would be greatly appriciated.

If I could get through the ode part I'm sure the other two will work
I've worked with octave in my linear algabra class and from that point
on matlab and octave seemed very simalar 







-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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