Answered step by step
Verified Expert Solution
Link Copied!

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 2. Runge Problem 2. Runge-Kutta 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 v(t)(depending on time t) of a ball with mass m=0.6lbm and cross-sectional area
A=0.503ft2 in free fall can be described by the initial value problem (IVP)
v(t)=ubrace(g-CDA2mv(t)2ubrace)f(v)in(0,6]
v(0)=0.
Here, v(t)=dvdt,g=32.174fts2 is the gravity of Earth, =0.0765lbmft3 is the air density, and
CD=0.47 is the drag coefficient.
The exact solution to this IVP is given by
v(t)=vtanh(gtv)
where v=2mgCDA2. Use this exact solution to determine the orders of approximation of the
Runge-Kutta methods RK1-4 mentioned below through numerical means.
[RK1,c1,=tf(vk)],[vk+1,=vk+c1],[RK2,c1,=tf(vk)],[c2,=tf(vk+12c1)],[vk+1,=vk+c2]Compare the first-order (RK1, aka forward or explicit Euler method), second-order (RK2), third-order
(RK3), and fourth-order (RK4)(explicit) Runge-Kutta 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 1,2,3, or 4 to choose whether to calculate the value at vk+1 using the first-,
second-, third-, or fourth-order Runge-Kutta approximation, respectively, dt is the time step size, and
m,g, rho, C_D, and A are the free fall parameters mentioned above. The current velocity vk is used to
calculate the value vkp1=vk+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
right-hand side function f(v) of the ordinary differential equation.
function [out]=f(vk)
%dotsStart your calculations with the time step size t=1s, and halve t successively nine times to gen-
erate ten calculations for each Runge-Kutta method. For each time step (in each calculation associated
with one (constant) time step size t), call the computeRungeKuttaSolution function repeatedly
to solve the given IVP up to tfinal=6s using each of the four numerical methods. Generate three plots
associated with the time step sizes tin{1,0.5,0.25}. Each plot should consist of the exact solution
and piecewise linear interpolants (MATLAB default) of the four Runge-Kutta approximations.
Determine the order of approximations of the various Runge-Kutta methods in terms of the ratios of
the (absolute values of the) exact errors, as obtained from each of the four Runge-Kutta 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{1,3,5}. Use a 1-D (or 2-D) array to store the necessary exact
error values for each of the four Runge-Kutta 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 outputErrorResults(method,dt,err,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 10). Note also that in this function, dt 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 Runge-Kutta methods are given by
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions