| 123456789101112131415161718 |
- % Constants
- K = 1000; % Carrying capacity
- P0 = 50; % Initial population
- r = 0.1; % Growth rate
- % Population over time
- P = @(t) K ./ (1 + ((K-P0)/P0) * exp(-r*t));
- % Task 1
- P(20)
- % Task 2
- time = 0:0.5:100;
- population = P(time);
- plot(time, population, 'LineWidth', 2);
- xlabel('Time');
- ylabel('Population');
- grid on;
|