peterhowells

Bacterial Growth in a Colony

Nov 3rd, 2016
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.47 KB | None | 0 0
  1. %Bacterial growth in a colony
  2. clc;
  3. close;
  4.  
  5. %input intital data
  6. no = input('Enter the initial bacterial count: ');
  7. t = input('Enter the elapsed time in hours: ');
  8.  
  9. for time = 0:1:t
  10.     n = no*exp(1.386*time);
  11.     s = sprintf('time: %d hr -->  bacteria count: %0.0f', time, n);
  12.     disp(s);
  13. end
  14.  
  15. %plot the data
  16. time = 0:0.1:t;
  17. n = no*exp(1.386*time);
  18. plot(time, n);
  19. grid;
  20. title('Exponetial Growth of Bacteria');
  21. xlabel('Time (hours)');
  22. ylabel('Bacterial Count');
Advertisement