Question: Matlab Programming- 2. The logistic equation (Verhulst model) describes population growth dN/dt = r*N*(1-N/K )N - population r - maximum population growth rate K -
Matlab Programming-
2. The logistic equation (Verhulst model) describes population growth
dN/dt = r*N*(1-N/K
)N - population
r - maximum population growth rate
K - carrying capacity (finite resources to sustain the population)
(A) write a FUNCTION N = logistic(r,K,N0,t) that takes in model parameters r and K, the initial condition N0, and a array t denoting time, and evaluates the logistic equation solution at time points in t. (You may want to use interp1 since ODE45 doesn't allow you to input specified time points)
in the same figure, plot for t = 0:0.01:10:
(population growth)
logistic(3,2000,1,t)
logistic(2,2000,1,t)
(population decline)
logistic(0.4,2000,5000,t)
logistic(0.2,2000,5000,t)
save your figure as hw8_q2a.jpg
(B) load dataset logistic_data.mat and use nlinfit() to find the parameters r and K as well as the initial population N0 when the data is modelled after the logistic equation. Generate 2 figures: 1. your fitted curve and the data on the same plot. 2. the residual (model-data mismatch) resulting from the fit.
save your plot of fitted curve/data as hw8_q2b.jpg, your plot of residuals as hw8_q2b_residual.jpg
save your script as hw8_q2.m
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
