function parabolasingle(r,k,n0,nostep,maxr) % plots a state space rendering of the May's equation %r - intrinsic growth rate %k - carrying capacity %n0 - initial population size %nostep - number of steps for simulation %maxr is used to plot everything in the same scale if called several times if maxr < r maxr=r; end x=0:k/100:k; plot(x,[x;r.*x.*(k-x)./k]); axis([0 k 0 maxr*k/2]); title(r); hold on; n=maysingle(r,k,n0,nostep); for t=1:nostep-1 plot([n(t) n(t)],[n(t),n(t+1)],'r') plot([n(t) n(t+1)],[n(t+1),n(t+1)],'r') end hold off;