%Function that determines population during exponential growth
function [t,y] = expgrowth(y0,totaltime, steps, rate)
%y0 = intitial population
%time = growth time
%steps = how many time steps
%rate = doubling time
t = linspace(0,totaltime,steps);
y(1) = y0;
%now we use euler method to step forward in time
%n(t + dt) = n(t) + (dn/dt)*dt
for i = 2:steps
%dn/dt = alpha*n
%dn/dt = log(2)/rate*n
dt = totaltime/steps;
y(i) = y(i-1) + ((log(2)/rate)*y(i-1))*dt;
end