% This script plots 2 different growth models M and N
% Mimics the experiment of taking bacteria and growing in one culture until
% time tau and then removing and placing in another culture yielding a
% population M. Each culture yields a different growth rate
% Here tau = 10 mins
% N(t): number of bacteria in culture 1 at time t
% M(t): number of bacteria in culture 2 at time t
% Main question: can population model P(t) = N for t<=tau and 
% P(t) = M for t > tau satisfy a differential equation?
% Fred Park, Math 354 Whittier College F2017

close all;
home

t = [0:1:20];
R = log(4/3);
N0 = 1500;
N = @(t) 1500*exp(R*t); % function handle to first growth model
tau = t(11); % note: t(1) = 0, t(11) = 10; t(n+1) = n
M0 = N(tau); % set initial condition of M0 = N(tau) = N(10). 
R1 = -0.25*R; % i.e. negative 1/4 of R
M = @(t) M0*exp(R1*(t-tau));


%first way to plot
figure(1);
plot(t(1:11),N(t(1:11)),'c-'); hold on
plot(t(11:20),M(t(11:20)),'m-'); hold off
legend('Growth Model: N', 'Growth Model: M')

%second way to plot
figure(2);
plot(t(1:11),N(t(1:11)),'c-',t(11:20),M(t(11:20)),'m-');
legend('Growth Model: N', 'Growth Model: M')

s1 = 'Main question: can a population model P(t) = N for t<=tau and'; 
s2 = 'P(t) = M for t > tau satisfy a differential equation?';
disp(s1)
disp(s2)
disp(' ')

inp = input('Please enter ''y'' for yes or ''n'' for no: ','s');

if inp == 'y'
    disp('please explain in words why on a sheet of paper')
else
    disp('please reconsider your conclusion')
end




