%% script file to solve a logistic differential equation
%% requires Octave (lsode)

x0 = 0.2;  % initial value
t0 = 0;    % initial time
Tend = 10; % time interval for which solution has to be computed
n = 50;    % number of intermediate times


%% define the function describing the right hand side
function y = logF(x,t)
  y = x-x.*x ;
endfunction

T = t0+linspace(0,Tend,n);

X = lsode('logF', x0, T);

plot(T,X)
axis([0,Tend,0,1]); grid on;

X2 = lsode('logF', 2*x0, T);
X3 = lsode('logF', 0.2*x0, T);

plot(T,[X X2 X3])
xlabel('time t'); ylabel('population'); grid on
axis;
