help-octave
[Top][All Lists]
Advanced

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

Re: phase space


From: Johannes Wolfgang Woger
Subject: Re: phase space
Date: Fri, 03 Apr 2009 15:47:37 +0200
User-agent: Thunderbird 2.0.0.21 (X11/20090302)

Carlo de Falco schrieb:

On 3 Apr 2009, at 14:55, Johannes Wolfgang Woger wrote:

Hi,
I am an newby.

How can I obtain a plot of the phase portrait
of Lotka-Volterra:

octave:92> function xdot = f(x,t)
a = 4;
b = 4;
c = 4;
d = 8;
E = 1;
K = 1;
xdot = zeros(2,1);
xdot(1) = x(1)*(a-b*x(2)-E*x(1));
xdot(2) = x(2)*(d*x(1)-c-K*x(2));
endfunction
octave:93>
octave:93> t = linspace(0,50,100);
octave:94> x = lsode("f", [2,1],t);
octave:95> plot(t,x);


plot(x(:,1), x(:,2));
xlabel("x_1");
ylabel("x_2");

but I would suggest using a few more time steps if you want a nice looking spiral...

Thanks, works great. Is there a tutorial addressing phase space?

Thanks

HTH,
c.





reply via email to

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