Question
Population growth can be modeled via an ordinary differential equation of the form dP(t)dt=k P(t)dP(t)dt=k P(t) (5) where P(t)P(t) represents the number of individuals in
Population growth can be modeled via an ordinary differential equation of the form
dP(t)dt=k P(t)dP(t)dt=k P(t) | (5) |
where P(t)P(t) represents the number of individuals in a population as a function of time, tt represents time, and kk is a proportionality constant. Consider a particular population of vertebrates whose population growth can be modeled as follows:
The proportionality constant kk is 0.1; the units for kk are 1/year.
The initial time (i.e. t0t0) for the population is 0 years.
The final time (i.e. tftf) for the population is 60 years.
The initial population (i.e. p0=p(t0)p0=p(t0)) is 8 individuals.
Assume that no individuals leave the population during the time interval of interest.
Complete the following:
Analytically solve this population growth problem using the techniques of calculus. Note that this first-order ordinary differential equation is separable, so you do not need to make use of any mathematical techniques beyond those you saw in MATH 140 or MATH 141; all you need to do is write Eqtn. 5 in the form A dP=B dtA dP=B dt and then integrate both sides of the equation. Do not submit any written analysis for this task, though you will use this information for other portions of this problem.
Numerically solve this population growth problem using the forward Euler integration technique. Use a time step size of 2 years. Store your derivative term in an anonymous function and use that anonymous function in your forward Euler solution implementation. You may recall that we discussed anonymous functions in Lecture 07.
Next, numerically solve this population growth problem using the built-in function ode45. Instead of using a separate programmer-defined function file, however, define your function inside of the ode45 function call like such: ode45(@(t,p) your_function, ...) Remember that one of the inputs to ode45 is another function (the "states"); here, we are merely defining what the function is inside of the ode45function call instead of listing the name of another function created elsewhere. The programming paradigm of using functions as inputs to other functions is aptly known in computer science as "functional programming."
Finally, plot the analytic (i.e. exact) result, the forward Euler solution, and the ode45 solution on the same plot. Include an appropriate title, an appropriate xx-label, and an appropriate yy-label. Use different line colors and data markers for each line. Include a legend, and programmatically set the legend so that it will automatically be out of the way of the data.
Remember that the results from the forward Euler and the ode45 numerical solution approaches are approximate. You may reasonably anticipate, therefore, some error between the numerical solutions and the analytic solution. Generally, however, the more rigorous the numerical solution approach is, the better the approximate numerical solution will be. The trade-off between effort required and solution quality is a common theme in many STEM fields.
Hints:
For the forward Euler portion of this problem, note that I am asking you to code the algorithm we discussed in slides 15-18 of Lecture 25. In that lecture, I showed you how to perform the forward Euler operation by hand; now, you will implement the algorithm programmatically.
A sample solution plot (created without specifying ode45 tolerances or ode45 time step sizes) follows:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started