problem1_popgrowthplot.m 319 B

123456789101112131415161718
  1. % Constants
  2. K = 1000; % Carrying capacity
  3. P0 = 50; % Initial population
  4. r = 0.1; % Growth rate
  5. % Population over time
  6. P = @(t) K ./ (1 + ((K-P0)/P0) * exp(-r*t));
  7. % Task 1
  8. P(20)
  9. % Task 2
  10. time = 0:0.5:100;
  11. population = P(time);
  12. plot(time, population, 'LineWidth', 2);
  13. xlabel('Time');
  14. ylabel('Population');
  15. grid on;