% solves logistic equation with Euler  

global c ;

c=0;
 
tmax=20;
dt=.02;
y(1)=.01;
time=0;
nt=1;
t(1)=time; 
 
while time < tmax
 
timep=time+dt;

if timep > tmax
  dt
  time
  dt=tmax-time
end

[time,y,nt]=euler(time,y,nt,dt);
time=time+dt;
t(nt)=time;

end
 
nt
time
 
figure(1);
plot(t(1:nt),y(1:nt));
ylabel('Population N');
xlabel('Time');
axis([0 tmax 0 2]);



