The Lotka-Volterra predator-prey model estimates the populations of two interacting species, H and L using first-order differential equations:
\frac{dH}{dt} = a \* H - b \* H \* L
\frac{dL}{dt} = d \* H \* L - c \* L
where a is the prey's growth rate, b is the prey's death rate, d is the predator's growth rate and c is the predator's death rate.
We want to model the population of snow hares (H) and Canadian lynxes (L).
Assume:
\begin{itemize}
\item The population at $t = 0$ is 100 hares and 5 lynxes
\item All rates are constant
\item No other factors influence population size
\end{itemize}
Your script should:
1. Implement the predator-prey model with $a = 0.48$, $b = 0.025$, $c = 0.68$ and $d = 0.02$.
2. Solve the system of differential equations via ode45 for $t = 0$ to 40 years in steps of 0.25 years. Name your time span variable tspan. Name your initial
conditions vector P0. Name your anonymous function (column vector) dPdt.
3. Assign the resulting population estimates to a 2-column matrix named P. Prey (H) should be in the first column and predator (L) in the second.
4. Plot H vs t and L vs t.
5. The populations of hares (H) and lynxes (L) vary cyclically. Estimate the period (in years) of this variation from the plot. Assign that value to a variabled named
Period.