%% Modeling Yeast Growth
%% Kurt Bryan and SIMIODE
%
% Notebook to support Exercise 2.2.8, modeling yeast population growth.
%
% The data, in time/population pairs.

times = [0:17];
pop = [9.6, 18.3, 29, 47.2, 71.1, 119.1, 174.6, 257.3, 350.7, 441, 513.3, 559.7, 594.8, 629.4, 640.8, 651.1, 655.9, 659.6];

% A plot:

plt1 = plot(times,pop,'-r');

% Given that u(0) = 9.6, the solution to the logistic equation with intrinsic growth rate "r" and carrying capacity "K" is

u = @(t,r,K) K./(1+exp(-r*t)*(K/9.6-1))

% Take a guess r = 1 and K = 600, plot, compare to the data

plt1;
hold on;
plt2 = plot(times, u(times,1,600),'-b'); 
hold off

% Perhaps we can do better...