ECE 3040 Lecture 22: Numerical Solution of Differential Equations
ECE 3040 Lecture 22: Numerical Solution of Differential Equations
Introduction
Euler’s method for solving first-order ODEs
Euler’s method for higher-order ODEs
Error analysis of Euler’s method
Improving Euler’s method: Heun’s & Runge-Kutta methods
Matlab’s function ode45
Case study: Bungee jumper
Appendix: Symbolic solution of ODE’s using Matlab’s dsolve
Introduction
Differential equations are common place in engineering. They arise from the
analysis of engineering systems as mathematical models that describe the behavior
of a variable physical quantity, 𝑦(𝑥), such as electric current, voltage, displacement,
velocity, acceleration, fluid flow, heat transfer, etc. In such models, the unknown
𝑑𝑦 𝑑2 𝑦
function 𝑦(𝑥) appears in differentiated form ( = 𝑦 = 𝑦̇ , 2 = 𝑦 ′′ = 𝑦̈ , …). The
′
𝑑𝑥 𝑑𝑥
solution of a differential equation involves obtaining an analytical expression for
the function, 𝑦(𝑥). However, in some cases, the differential equation can involve
nonlinearities and might have no analytic solution. Also, some engineering systems
are described by a large set of dependent differential equations (linear or nonlinear).
In such cases, numerical solutions are the only feasible solutions.
𝑑𝑦(𝑥)
= 𝑥2 − 1
𝑑𝑥
𝑑𝑦(𝑥)
∫ 𝑑𝑥 = ∫(𝑥 2 − 1)𝑑𝑥
𝑑𝑥
or
∫ 𝑑𝑦(𝑥) = ∫(𝑥 2 − 1)𝑑𝑥
or
1
𝑦(𝑥 ) = 𝑥 3 − 𝑥 + 𝐶
3
In your differential equations course you have learned how to systematically solve
this equation to obtain the solution, 𝑦(𝑡) = 𝑒 −2𝑡 + 2. This solution can be verified
by confirming that it satisfies the above differential equation:
𝑑 −2𝑡
(𝑒 + 2) + 2(𝑒 −2𝑡 + 2) = −2𝑒 −2𝑡 + 2𝑒 −2𝑡 + 4 = 4
𝑑𝑡
The order of the differential equation is determined by the physical nature of the
system that generates it. For example, a linear electric circuit that contain 𝑛
independent energy storing elements (capacitors and/or inductors) is governed by
the 𝑛th-order linear differential equation [𝑔(𝑡) represents the source that drives the
circuit. In some cases, 𝑔(𝑡) = 0]
𝑑𝑛 𝑦 𝑑𝑛−1 𝑦 𝑑𝑦
𝑎𝑛 𝑛 + 𝑎𝑛−1 𝑛−1 + ⋯ + 𝑎1 + 𝑎0 𝑦 = 𝑔(𝑡)
𝑑𝑡 𝑑𝑡 𝑑𝑡
Circuit analysis techniques allow us to solve for the differential equation describing,
say, the current 𝑖(𝑡) that flows through the capacitor in the above circuit.
Application of such techniques leads to the differential equation
𝑑2 𝑖(𝑡) 𝑑𝑖 (𝑡)
3 + 2 + 𝑖(𝑡) = 0
𝑑𝑡 2 𝑑𝑡
𝑑𝑖(0)
The initial conditions 𝑖(0) and 𝑖 ′ (0) = can be determined from the circuit if
𝑑𝑡
the capacitor voltage and inductor current are known at 𝑡 = 0. It can be shown that
when the capacitor’s initial voltage is 1Volt and the inductor’s initial current is
√2
zero, then 𝑖(0) = 0 and 𝑖 ′ (0) = − . The solution to the differential equation
6
would then be
1 −1 𝑡 √2
( )
𝑖 𝑡 = − 𝑒 3 sin ( 𝑡)
2 3
The sum of the tangential forces must be zero (by Newton’s second law of motion),
𝑚𝑎𝑡 − ∑ 𝐹⃗𝑡 = 0
𝑑 2 𝜃(𝑡) 𝑑𝜃(𝑡)
𝑚𝐿 + 𝛾𝐿 + 𝑚𝑔 sin[𝜃(𝑡)] = 0
𝑑𝑡 2 𝑑𝑡
Where 𝑎𝑡 = 𝐿𝜃̈ is tangential acceleration and 𝑚 is the mass. For small swings we may write
sin(𝜃) ≅ 𝜃 (think Taylor series) and the system becomes linear.
In this section, numerical solutions are derived for first-order ODEs of the form
𝑑𝑦(𝑡)
𝑦 ′ (𝑡) = = 𝑓(𝑡, 𝑦(𝑡))
𝑑𝑡
This result can be discretized and expressed as the iterative formula (known as
Euler’s method) for estimating 𝑦(𝑘 + 1) from its current value 𝑦(𝑘),
Notice how the error increases as 𝑡 increases. The error is due to the finite step size
(ℎ). This local error also propagates from one step to the next and leads to a
cumulative global error that deteriorates the accuracy of the solution as 𝑡 increases.
Of course, choosing a smaller value for ℎ will improve the results.
The following user-defined Matlab function (ode_eul) implements Euler’s method
for solving a first-order ODE.
The ode_eul solution (green trace) using ℎ = 0.1 is compared to the exact solution
(blue trace) as shown in the following plot, for 𝑡 ∈ [𝑡𝑖 𝑡𝑓 ] = [0 4]. Note how f is a
function of t and y.
Euler’s Method for Higher-Order ODEs
𝑑𝑦1
= 𝑓1 (𝑡, 𝑦1 , 𝑦2 , … , 𝑦𝑛 )
𝑑𝑡
𝑑𝑦2
= 𝑓2 (𝑡, 𝑦1 , 𝑦2 , … , 𝑦𝑛 )
𝑑𝑡
.
.
.
𝑑𝑦𝑛
= 𝑓𝑛 (𝑡, 𝑦1 , 𝑦2 , … , 𝑦𝑛 )
𝑑𝑡
Euler’s method can readily be extended to solve the above system of equations. The
method is applied to each equation starting from the initial values, 𝑦𝑖 (𝑡0 ), and a set
of new values, 𝑦𝑖 (𝑡0 + ℎ), is obtained. Then, the iterations are repeated over and
over until some 𝑡𝑓 is reached. Euler’s method for a system of ODEs takes the form
where the first iteration (corresponding to setting 𝑘 = 0) starts with the specified
initial values:
𝑦1 (𝑡0 ), 𝑦2 (𝑡0 ), … , 𝑦𝑛 (𝑡0 )
Solution. First, we provide the exact solution for this differential equation
employing Matlab’s symbolic toolbox function dsolve (refer to the Appendix),
1 𝑡 √2
𝑦(𝑡) = − 𝑒 −3 sin ( 𝑡)
2 3
𝑑𝑦1
= 𝑦2 (Leading to: 𝑓1 (𝑡, 𝑦1 , 𝑦2 ) = 𝑦2 )
𝑑𝑡
𝑑𝑦2 𝑑2 𝑦 1 2 1 2
= = − 𝑦1 − 𝑦2 (Leading to: 𝑓2 (𝑡, 𝑦1 , 𝑦2 ) = − 𝑦1 − 𝑦2 )
𝑑𝑡 𝑑𝑡 2 3 3 3 3
The system’s associated initial conditions are 𝑦1 (0) = 0 and 𝑦2 (0) = 𝑦′(0) =
√2
− . The Euler’s iterative system (setting 𝑡0 = 0)
6
√2
𝑦2 (1) = −0.0333𝑦1 (0) + 0.9333𝑦2 (0) = −0.0333(0) + 0.9333 (− ) = −0.2200
6
Second iteration [set 𝑘 = 1 and use the just computed 𝑦1 (1) and 𝑦2 (1)]:
𝑦1 (2) = 𝑦1 (1) + 0.1𝑦2 (1) = −0.0236 + 0.1(−0.2200) = −0.0456
𝑦2 (2) = −0.0333𝑦1 (1) + 0.9333𝑦2 (1) = −0.0333(−0.0236) + 0.9333(−0.2200)
= −0.2045
1 −𝑡 √2
The exact solution 𝑦(𝑡) = − 𝑒 3 sin ( 𝑡) gives 𝑦(0.1) = −0.0228 and 𝑦(0.2) =
2 3
−0.0440. We may then compute the following absolute relative true errors (in
percent) for the numerical solution for 𝑦1 as,
At 𝑡 = 0.1:
𝑦(0.1) − 𝑦1 (1) −0.0228 − (−0.0236)
𝜀𝑟 = | | 100% = | | 100% = 3.5%
𝑦(0.1) −0.0228
At 𝑡 = 0.2:
𝑦(0.2) − 𝑦1 (2) −0.0440 − (−0.0456)
𝜀𝑟 = | | 100% = | | 100% = 3.6%
𝑦(0.2) −0.0440
The following user-defined Matlab function (ode_eul2) implements Euler’s method
for solving a system of two first-order ODEs.
The following Matlab instructions generate the solution of the differential equation
(from the last example) using ode_eul2, with ℎ = 0.1 and 0 ≤ 𝑡 ≤ 15,
The graph below compares Euler’s solution (blue trace) to the exact solution (green
trace). Obviously, making ℎ smaller will improve the approximation.
Consider the variable 𝑦(𝑡) and its derivative 𝑦′(𝑡) from the above system of linear
ODEs. When the system is stable (i.e., lim 𝑦′(𝑡) = 0), the trajectory of points
𝑡→∞
{𝑦(𝑡), 𝑦′(𝑡)} converges to a fixed-point (also known as an attractor or equilibrium
point) starting from any initial condition {𝑦(𝑡0 ), 𝑦′(𝑡0 )}. By setting all rates of
change to zero, one can obtain the system of equations
𝑑𝑦1
= 𝑦2 = 0
𝑑𝑡
𝑑𝑦2 1 2
= − 𝑦1 − 𝑦2 = 0
𝑑𝑡 3 3
In the above model, 𝑥 and 𝑦 represent the number of prey and predators,
respectively, 𝑎 is the prey growth rate, 𝑐 is the predator death rate and 𝑏 and 𝑑 are
coupling coefficients (they characterize the predator-prey interactions). The
multiplicative terms (𝑥𝑦) are what makes these equations nonlinear. The equations
are also known as the Lotka-Volterra equations that were developed independently
in the early part of the twentieth century by the American biologist Alfred Lotka
and the Italian mathematician Vito Volterra.
Example. Consider the following predator-prey model with initial conditions
𝑥(0) = 2 and 𝑦(0) = 1.
𝑑𝑥 (𝑡)
= 1.2𝑥 − 0.6𝑥𝑦
𝑑𝑡
𝑑𝑦(𝑡)
= −0.8𝑦 + 0.3𝑥𝑦
𝑑𝑡
Solve the system for 0 ≤ 𝑡 ≤ 30 using Euler’s method (try step sizes of ℎ = 0.05
and 0.001). Plot and compare the phase-plane trajectories [i.e., plot 𝑦(𝑡) versus
𝑥(𝑡)].
The method converges to an orbit for ℎ = 0.001 (or smaller values), as shown in
the following plot. It is interesting to see how the model predicts an ever-lasting,
periodic change in populations.
As the prey population increases, the abundance of food flourishes the predator
population. But, as the predator population increases at a rate faster than can be
supported by the prey, the prey population starts to dwindle. This, in turn, leads to a
drop in the predator population due to lack of food. This drop continues until both
populations reach the initial population values, 𝑥(0) and 𝑦(0), and the cycle
repeats.
It should be noted here that the initial conditions for this model are scaled. For
example, you can think of 𝑥(0) = 2 and 𝑦(0) = 1 to mean initial prey and predator
populations of 2000 and 1000, respectively.
Also, note that there is no equilibrium point for this particular dynamical system at
which both populations become constant. However, there are other sets of
coefficients {𝑎, 𝑏, 𝑐, 𝑑 } that can lead to a critical equilibrium point where the
populations are constant. This equilibrium point can be derived by setting both
rates, 𝑦̇ and 𝑥̇ , to zero:
0 = 𝑎𝑥 − 𝑏𝑥𝑦
0 = −𝑐𝑦 + 𝑑𝑥𝑦
𝑐 𝑎
and obtain the two solutions: (𝑥, 𝑦) = (0,0) and ( , ). Therefore, if we start with
𝑑 𝑏
no population (trivial case), we will never “create” predators nor prey! The other
solution is more interesting. It implies that if we start our model with the initial
𝑐 0.8 8 𝑎 1.2
populations 𝑥(0) = = = and 𝑦(0) = = = 2, then the populations will
𝑑 0.3 3 𝑏 0.6
never change.
Your turn: Employ Euler’s method (with the proper value for ℎ and 𝑡 ∈ [0 𝑡𝑓 ]) to
generate the phase-plane plot [𝜃̇ (𝑡) versus 𝜃(𝑡)] for the unforced pendulum with
damping, described by the nonlinear differential equation
𝜋 𝜋 𝜋
Generate plots for the initial conditions 𝜃̇ (0) = 0 and 𝜃 (0) = , , .
6 4 2
1
𝑦′(𝑡𝑖 ) ≅ [𝑦(𝑡𝑖+1 ) − 𝑦(𝑡𝑖 )]
ℎ
Therefore, at the first iteration, Euler method introduces an 𝑂 (ℎ2 ) error between the
estimated 𝑦(𝑡0 + ℎ) and its true value. However, this error is amplified in the
second iteration where the local error has a component that depends on the
propagated error from the first iteration, and so on. It can be shown that the global
truncation error due to repeatedly applying Euler’s method is of order 𝑂(ℎ).
Therefore, Euler’s method is referred to as a first-order method. And this result
explains why this method requires a very small step size to ensure accurate results.
But, using a very small step size leads to an increase in the number of function
evaluations, thus slowing down the computations and potentially introducing
machine round-off error.
For Euler’s method, the slope at the beginning of the interval (at 𝑡𝑖 ) is
𝑦′(𝑡𝑖 ) = 𝑓(𝑡𝑖 , 𝑦(𝑡𝑖 ))
One application of Euler’s method provides an estimate of 𝑦 at 𝑡𝑖+1 . Let us refer to
this estimate as 𝑦̃(𝑡𝑖+1 ),
𝑦̃(𝑡𝑖+1 ) = 𝑦(𝑡𝑖 ) + ℎ𝑦′(𝑡𝑖 ) = 𝑦(𝑡𝑖 ) + ℎ𝑓(𝑡𝑖 , 𝑦(𝑡𝑖 ))
This expression is referred to as the predictor equation. It leads to the following
derivative approximation at the end of the interval (at 𝑡𝑖+1 ),
𝑦′(𝑡𝑖+1 ) = 𝑓(𝑡𝑖+1 , 𝑦̃(𝑡𝑖+1 ))
An improved estimate of the slope can now be obtained by averaging the slopes
𝑦′(𝑡𝑖 ) and 𝑦′(𝑡𝑖+1 ), to obtain
′
𝑦 ′ (𝑡𝑖 ) + 𝑦′(𝑡𝑖+1 ) 𝑓(𝑡𝑖 , 𝑦(𝑡𝑖 )) + 𝑓(𝑡𝑖+1 , 𝑦̃(𝑡𝑖+1 ))
𝑦̅ = =
2 2
Finally, this average slope is employed in Euler’s method to arrive at the improved
estimate (known as the corrector equation),
𝑓(𝑡𝑖 , 𝑦(𝑡𝑖 )) + 𝑓(𝑡𝑖+1 , 𝑦̃(𝑡𝑖+1 ))
𝑦(𝑡𝑖+1 ) = 𝑦(𝑡𝑖 ) + ℎ𝑦̅ ′ = 𝑦(𝑡𝑖 ) + ℎ
2
In fact one can, yet, enhance the accuracy of the method by performing local
iterations (using the corrector equation) where the estimate 𝑦(𝑡𝑖+1 ) is recycled
several times in the same equation [i.e., substituted for 𝑦̃(𝑡𝑖+1 )]:
A relative error stopping criterion [between two consecutive 𝑦(𝑡𝑖+1 ) estimates] can
then be used to stop this iterative phase. Next, apply the whole process, again, at the
next time step (𝑡𝑖+2 ) employing the refined 𝑦(𝑡𝑖+1 ) value, and so on. It has been
shown that Heun’s method has a global error that is 𝑂(ℎ2 ), making it much more
accurate (for a given ℎ) than Euler’s method.
The results for Heun’s method are summarized in the following table and are
compared to a single application of Euler’s method. The error measure used in the
table is the percent absolute relative true error.
Runge-Kutta Methods. So far, we have seen that both Euler’s and Heun’s methods
have the general form
𝑦(𝑡𝑖+1 ) = 𝑦(𝑡𝑖 ) + ℎ 𝜑(ℎ, 𝑡𝑖 , 𝑦(𝑡𝑖 ))
where the increment function 𝜑 is designed to estimate the slope over the interval.
The Runge-Kutta (RK) methods belong to this general iterative equation. RK
methods exist with varying order of accuracy, the most popular (and useful) is the
fourth-order RK method (RK4) which has a global truncation error of 𝑂(ℎ4 ). The
following is the RK4 iterative formula for solving 𝑦′(𝑡𝑖 ) = 𝑓(𝑡𝑖 , 𝑦(𝑡𝑖 )),
ℎ
𝑦(𝑡𝑖+1 ) = 𝑦(𝑡𝑖 ) + (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
6
where the 𝑘𝑖 functions are given by
𝑘1 = 𝑓(𝑡𝑖 , 𝑦(𝑡𝑖 ))
ℎ ℎ
𝑘2 = 𝑓 (𝑡𝑖 + , 𝑦(𝑡𝑖 ) + 𝑘1 )
2 2
ℎ ℎ
𝑘3 = 𝑓 (𝑡𝑖 + , 𝑦(𝑡𝑖 ) + 𝑘2 )
2 2
𝑘4 = 𝑓(𝑡𝑖 + ℎ, 𝑦(𝑡𝑖 ) + ℎ𝑘3 )
Similar in spirit to Heun’s method, the RK4 method can be thought of as applying
an improved estimate of the slope by using a weighted-average of four different
slope estimates. The following example illustrates the application of the RK4
method.
This result is superior (in accuracy) to the one obtained using Euler’s and Heun’s
methods. However, one should keep in mind that the slope estimate of RK4 is more
elaborate than the simple one used by Euler’s method (RK4 uses four function
evaluations and Euler’s method uses only one).
Your turn: (See Problem 8 in Assignment 14) Develop a Matlab function that
implements the RK4 method. Test your function for the ODE of the last example.
Compare (by graphing) the RK4 solution to that of Euler’s method and to the exact
solution (use ℎ = 1, and 𝑡 ∈ [0 4]).
Your turn: Develop a Matlab function that implements the [𝑂(ℎ2 )] two-step
Adams–Bashforth method, given be the iterative formula (𝑘 = 1, 2, 3, 4, … ),
3 1
𝑦(𝑘 + 1) = 𝑦(𝑘) + ℎ𝑓(𝑘ℎ, 𝑦(𝑘)) − ℎ𝑓((𝑘 − 1)ℎ, 𝑦(𝑘 − 1))
2 2
Employ one step of Euler’s method, starting from the specified 𝑦(0), to obtain
𝑦(1). These two initial values [𝑦(0) and 𝑦(1)] are required to initiate the Adams–
Bashforth method. Test your function for the ODE of the last example. Compare
(by graphing) the Adam-Bashforth solution to that of Euler’s method and to the
exact solution (use ℎ = 1, and 𝑡 ∈ [0 4]).
Matlab’s Function ode45
Matlab has several built-in ODE solvers. One particular solver is called ode45 and
is based on fourth- and fifth-order Runge-Kutta methods. The function can solve a
single ODE or a system of ODEs. The basic call has the syntax,
y is the solution array where each column is one of the dependent variables, t is the
corresponding time column vector and fun is a user defined function that represents
the right-hand-side array of the ODE system, 𝑓(𝑡, 𝑦(𝑡)). Also, tspan = [ti tf]
specifies the initial and final values of the desired solution interval and y0 is a
vector containing the initial values. ode45 computes the step size ℎ adaptively and,
therefore, there is no need to specify its value in the function call.
Solution.
Example. Solve the predator-prey model using ode45. Assume the initial
normalized populations 𝑥(0) = 2 and 𝑦(0) = 1. Plot 𝑥(𝑡) and 𝑦(𝑡). Also, generate
the phase-plane trajectory for 𝑦(𝑡) versus 𝑥(𝑡).
𝑑𝑥 (𝑡)
= 1.2𝑥 − 0.6𝑥𝑦
𝑑𝑡
𝑑𝑦(𝑡)
= −0.8𝑦 + 0.3𝑥𝑦
𝑑𝑡
Solution. When dealing with a system of equations, ode45 requires a function that
represents the right-hand-side of the system of ODEs as an array. Here, we have to
treat 𝑥 and 𝑦 as the elements of an array and rename them as, [𝑦(1) 𝑦(2)].
We may also have used the following equivalent but more explicit syntax,
We may generate the phase-plane trajectory plot for 𝑦(𝑡) versus 𝑥(𝑡) as follows,
The ode45 plots for the above system can be made smoother if we restrict the size of
the largest step size ℎ that the algorithm generates. This can be done employing the
“options” command. So, if we want to restrict ℎ < 0.01 we then use the instructions:
Typing
results in
Case Study: Bungee Jumper
You are hired by an amusement park to determine the maximum weight allowed for
a bungee jumper. You were told that during the jump the jumper should be 8 meters
above ground level, at all times.
The first step was for you to refresh on the physics of a mass in motion. You
recalled the following physical laws/principles:
𝑑𝑣(𝑡)
Newton’s second law: ∑ 𝐹⃗ = 𝑚𝑎 = 𝑚 (𝑚 is the jumper’s mass in kg
𝑑𝑡
and 𝑎 is gravitational acceleration constant in m/s2).
Force (pointing toward earth) exerted by gravity on a falling object of mass 𝑚
is 𝐹𝑔 = 𝑚𝑔, where 𝑔 is gravitational acceleration (𝑔 ≅ 9.81m/s2).
Force due to a stretched spring (elastic cord) of length L (Hooke’s law):
𝐹𝑐𝑜𝑟𝑑 = 𝑘(𝑥 − 𝐿), where 𝑥 > 𝐿 and 𝑘 is the spring constant. The force
direction is opposite to that of motion.
Force due to air resistance (opposite to direction of motion): 𝐹𝑎𝑖𝑟 = 𝑐𝑑 𝑣 2 ,
where 𝑐𝑑 (kg/meter) is the drag coefficient and 𝑣 is the object’s velocity.
Force due to damping in cord (opposite to direction of motion): 𝐹𝑑 = 𝛾𝑣,
where 𝛾 (N.s/meter) is a damping coefficient.
You also made the following initial measurements and did some research to arrive
at the following:
So, by applying Newton’s second law to the falling body you obtained the equation
𝑑𝑣
𝑚 = 𝐹𝑔 − 𝐹𝑎𝑖𝑟 − 𝐹𝑐𝑜𝑟𝑑 − 𝐹𝑑
𝑑𝑡
𝑑𝑣
𝑚 = 𝑚𝑔 − 𝑠𝑖𝑔𝑛(𝑣)𝑐𝑑 𝑣 2 − 𝑘 (𝑥 − 𝐿) − 𝛾𝑣
𝑑𝑡
Dividing the above equation by 𝑚, you obtained the following first-order ODE that
models the bungee jumper’s velocity,
𝑑𝑣 𝑐𝑑 2 𝑘 𝛾
= 𝑔 − sign(𝑣) 𝑣 − (𝑥 − 𝐿) − 𝑣
𝑑𝑡 𝑚 𝑚 𝑚
𝑑𝑣 0.25 2 40 8
= 9.81 − sign(𝑣) 𝑣 − (𝑥 − 30) − 𝑣 (CS1)
𝑑𝑡 𝑚 𝑚 𝑚
In this (nonlinear) ODE, positive velocity points towards Earth. Since the force due
to air resistance has a direction opposite to that of motion, and since the bungee
jumper can travel upward due to the “sling shot effect” of the cord, the sign of this
force should be opposite to that of velocity 𝑣. The sign(𝑣) function (also, built into
Matlab) returns the sign of its argument; thus automating the process of reversing
the direction of the air resistance force. We should also note that if 𝑥 < 30 (cord is
40 8
un-stretched) then the above equation should exclude the (𝑥 − 30) and 𝑣 terms
𝑚 𝑚
.
Now, the hard work is done! What is left is to employ a numerical technique to
solve the ODE. You decided to use Matlab’s ode45 function with the formulation
𝑑𝑥
𝑦1 = 𝑥 and 𝑦2 = 𝑣 = . Therefore, you represented the ODE as the system of
𝑑𝑡
equations,
𝑑𝑦1
= 𝑦2
𝑑𝑡
𝑑𝑦2 0.25 2 40 8
= 9.81 − sign(𝑦2 ) −
𝑦2 + { 𝑚 1 (𝑦 − 30 ) − 𝑦2 𝑖𝑓 𝑦1 > 30
𝑑𝑡 𝑚 𝑚
0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
You then created the following Matlab function that evaluates the right-hand-side of
the above system of ODEs. This function allows the mass to be an input parameter.
You set the mass of the jumper (initially) to 100 kg.
Here is the solution you obtained for the displacement of the jumper for the settings
0 ≤ 𝑡 ≤ 100 sec, 𝑥 (0) = 0 and 𝑣 (0) = 0 (recall that the rules require the jumper to
drop in a free fall). Here, the platform is taken as the reference point (origin) for
displacement, 𝑥.
According to the above plot, if the jumper weight is 100 kg he/she will come as
close as 12 meters from ground level. You repeated the simulation using a slightly
larger mass, say 105 kg, and obtained:
The above simulation reveals that a bungee jumper of mass 105 kg will drop to
about 8 meters from ground level. Based on these results you submit your report to
the amusement park management advising for a 105 kg (about 230 lb.) limit on the
jumper’s weight.
Note that the terminal (final) position of the jumper is obtained by setting the
40
velocity and its derivative to zero in Equation (CS1), 9.81 − (𝑥 − 30) = 0,
105
or 𝑥 ≅ 55.75 meters below the platform.
Just for fun, you generated the following phase-plane trajectory plot describing the
motion of the bungee jumper,
From the plot, we see that the maximum velocity of the jumper is about 25 m/s (or
90 km/hr or 56 miles/hr), and is attained at about 45 meters below the platform.
Appendix: Symbolic Solution of ODE’s Using Matlab’s dsolve
√2
with 𝑦(0) = 0 and 𝑦′(0) = −
6