Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 2 . Runge Problem 2 . Runge - Kutta Methods Applied to the Free Fall Problem Write a Matlab script based on three functions
Problem Runge Problem RungeKutta Methods Applied to the Free Fall Problem
Write a Matlab script based on three functions to solve the free fall problem. Taking air resistance into
account, the velocity depending on time of a ball with mass and crosssectional area
in free fall can be described by the initial value problem IVP
ubraceubrace
Here, is the gravity of Earth, is the air density, and
is the drag coefficient.
The exact solution to this IVP is given by
where Use this exact solution to determine the orders of approximation of the
RungeKutta methods RK mentioned below through numerical means.
Compare the firstorder RK aka forward or explicit Euler method secondorder RK thirdorder
RK and fourthorder RKexplicit RungeKutta methods, which generally rely on breaking a single
time step down into multiple, incremental calculations to reduce overall error. To this end, do the following:
Write the following function that contains all four methods to advance the approximate solution by
one time step.
Here, method is either or to choose whether to calculate the value at using the first
second third or fourthorder RungeKutta approximation, respectively, dt is the time step size, and
rho, CD and A are the free fall parameters mentioned above. The current velocity vk is used to
calculate the value dots at the next time step, and the updated value is returned as the
single output. Note that although all four methods are included in a single function, only the result
generated by the method option will be calculated with a single function call.
To make this function more versatile, write the following nested function that evaluates the given
righthand side function of the ordinary differential equation.
function out
dotsStart your calculations with the time step size and halve successively nine times to gen
erate ten calculations for each RungeKutta method. For each time step in each calculation associated
with one constant time step size call the computeRungeKuttaSolution function repeatedly
to solve the given IVP up to using each of the four numerical methods. Generate three plots
associated with the time step sizes Each plot should consist of the exact solution
and piecewise linear interpolants MATLAB default of the four RungeKutta approximations.
Determine the order of approximations of the various RungeKutta methods in terms of the ratios of
the absolute values of the exact errors, as obtained from each of the four RungeKutta approxima
tions. More precisely, determine the ratios of the exact errors from the previous time step size to the
current time step size at the times tin Use a D or D array to store the necessary exact
error values for each of the four RungeKutta approximations at the given times, and output the results
to the command window in the following format the values shown are for illustration purposes only:The output shall be generated by the following output function.
function outputErrorResultsmethoddterr,maxIt
Here, err is the array with the error values mentioned above, and maxIt is the maximum number of
time step size iterations in this case Note also that in this function, is an array that includes all
time step sizes considered in this problem whereas it is a scalar value in the computeRungeKutta
Solution function consequently the computeRungeKuttaSolution function needs to be called
with only one element of the dt array
By examining the error ratios shown above, explain how you can verify through numerical means
that the orders of approximation of the four different RungeKutta methods are given by
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