system of ODE's carrying capacity and population dynamics

William Christopher Carleton williamcarlet at trentu.ca
Thu Nov 20 11:44:46 CST 2008


I'm slowly progressing with Octave and figuring out how to have systems demonstrate the behaviour I want, but I'm now completely stumped. Here's the system so far (in Octave code);

function xdot=f(x,t)
k=0.01
xdot(1)=x(1) * k * ((x(2) - x(1)) / x(2))
xdot(2)=x(2) * (-k * (x(1) / x(2))
endfunction

t=linspace(0,500,500)
x0=[10 1000]
x=lsode('f',x0,t)

which demonstrates a decreasing carrying capacity as the population increases. The next step, that I've been stuck on, is having the carrying capacity recover when the population drops (after the functions cross). This is likely more of a math question than a specifically 'Octave' one, but I might be doing something wrong with the code as well... Any help is greatly appreciated,

Chris




More information about the Help-octave mailing list