%filename:sim.m % Simple Exponential Growth Abrupt Cut-off % W + S = Wo + So = Wf + Sf % No lose / no gain % Wo is the initial weight,Wf is the final weight. % So is the initial substrate,Sf is the final substrate. % dW/dt = mu*W, mu is the growth rate and it is around 0.008. global mu Wo So tf data; tf = (log((Wo + So)/Wo)/mu); Wf = Wo*exp(mu*tf); Sf = Wo + So -Wf; t0=0; [t,W] =ode23('simf',t0,tf,Wo); t = [t;tf+200]; W = [W;Wf]; subplot(2,1,1);plot(t,W,'b'); xlabel('t:time in days'); ylabel('W:weight in lbs'); title('Simple Exponential Growth with Abrupt Cut-off,LINEAR.'); grid; subplot(2,1,2);plot(t,log(W),'b'); xlabel('t:time in days'); ylabel('W:weight in lbs'); title('Simple Exponential Growth with Abrupt Cut-off,SEMILOG.'); grid; %Save the figure into GIF file. % print -dgif8 simexp print -dpbm simexp.pbm %print simexp.ps %Save output into HTML file. fprintf(''); fprintf('\n
'); fprintf('\n');
fprintf('\nThe growth rate is %10.4f.
',mu);
fprintf('\nThe final time is %10.4f.
',tf);
fprintf('\nThe initial weight is %10.4f.
',Wo);
fprintf('\nThe final weight is %10.4f.
',Wf);
fprintf('\nThe initial substrate is %10.4f.
',So);
fprintf('\n');
fprintf('\n');