Question: Develop an M-file to solve a single ODE with the midpoint method. Design the M-file so that it creates a plot of the results. Test
Develop an M-file to solve a single ODE with the midpoint method. Design the M-file so that it creates a plot of the results. Test your program by using it to solve for population as described in Prob. 22.5. Employ a step size of 5 years.
Data From Problem 22.5
Although the model in Prob. 22.4 works adequately when population growth is unlimited, it breaks down when factors such as food shortages, pollution, and lack of space inhibit growth. In such cases, the growth rate is not a constant, but can be formulated as
kg = kgm(1 − p/pmax)
where kgm = the maximum growth rate under unlimited conditions, p = population, and pmax = the maximum population. Note that pmax is sometimes called the carrying capacity. Thus, at low population density p ≪ pmax, kg → kgm. As p approaches pmax, the growth rate approaches zero. Using this growth rate formulation, the rate of change of population can be modeled as
![]()
This is referred to as the logistic model. The analytical solution to this model is

Simulate the world’s population from 1950 to 2050 using
(a) The analytical solution, and
(b) The fourth-order RK method with a step size of 5 years. Employ the following initial conditions and parameter values for your simulation: p0 (in 1950) = 2,560 million people, kgm = 0.026/yr, and pmax =12,000 million people. Display your results as a plot along with the data from Prob. 22.4.
dp dt = kgm (1-P/Pmax) P
Step by Step Solution
3.25 Rating (169 Votes )
There are 3 Steps involved in it
clc clear all kgm 0026 pmax 12000 f xy kgm 1ypmax y f function handle for fxy x0 1950 x0 initi... View full answer
Get step-by-step solutions from verified subject matter experts
