Question: We discussed in class how to integrate the initial value problem df dt = g(f,t) using Forward/Backward Euler method and the trapezoidal rule. Modify

We discussed in class how to integrate the initial value problem df dt = g(f,t) using Forward/Backward Euler method and the trapezoidal rule. Modify the MATLAB program given in class for this purpose to solve the above equation using the previous methods when g(f,t)-tf and f(0) = 1 using a suitably defined time increment. A popular method of integration is using a series of Runge-Kutta methods. Here, we describe a fourth order RK method (also known as RK4) where in order to proceed one time step, three sub-steps must be taken: f+1/2 = fn +Atg(t", f") Euler half-step predictor fn+1/2 = fn + Atg(n+1/2, fn+1/2) Backward Euler half-step corrector f+1 = fn + Atg(n+1/2, fn+1/2) Midpoint rule full-step predictor fn+1 = fn + At[g(t", f") + 2g (+n+1/2, fn+1/2) + 2g(+n+1/2, fn +1/2) + g(tn+1, fn+1)] Simpson's rule full-step corrector Write a Matlab program to integrate the above equation using RK4 and perform an error analysis by plotting the error as a function of the inverse of the time increment in a log-log plot. Discuss about your results.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
