can be done in any of the following: c/c++/python/matlab... Consider the initial
ID: 3719571 • Letter: C
Question
can be done in any of the following: c/c++/python/matlab...
Consider the initial value problem:
dy(t)/dt = 0.3 ? 0.1y(t), 0 ? t ? 1
y(0) = 0.
(a) Find the exact solution.
(b) Write a code to implement Euler’s method. As output, your code should provide the approximation Wi to the solution y(Ti) at each step of the algorithm. Use your code to find an approximation for y(1) with h = 0.2.
(c) Modify your code to implement Runge Kutta Method of order 4. Use step size h = 0.2.
(d) Compare these approximations for y(1) with the exact solution at t = 1 and comment about the relative accuracy, by computing the relative errors
Yappror - Yeract YeractExplanation / Answer
% [t, y]=EULER_forward_ODE(f, t0, y0, tend, Niter)
% Euler forward approximation method to solve Initial Value Problem
% f defines the function f(t,y)
% t0 defines initial value of t
% y0 defines initial value of y
c)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.