r=1; % rate constant in the logistic equation
K=1; % saturation population size
% choose a step that is much smaller than the smallest time scale in the
% problem
step=0.1;
% Total Integration time
TotalTime=10;
% The initial conditions is
N0=0.01;
% Now, do it for the actual integration
% We'll have our time information in the vector N
N(1)=N0;
% m is a counter that we will use in the for loop
m=2;
for i=step:step:TotalTime
N(m)=N(m-1)+r*step*N(m-1); %
m=m+1; % increment the counter
end
Times=0:step:TotalTime; % create a vector of times for x-axis
plot(Times,N,'-b')
xlabel('time')
ylabel('number of cells')
title('Exponential Growth')