You are on page 1of 1

Assignment for Numerical methods review

Note: Please make sure you can do this though you need not bring this to the lab. This is
especially for those who have trouble with programming or no previous experience with
numerical methods
dy
1) Consider the ODE dt ty
Write a program to solve this ODE using Eulers method. The user should call the program in the
following fashion eulode(t0, tf,y0,h). Here,
t0 is the initial time.
tf is the final time.
y0 = y(t0)
h is the time step.
a) Plot the exact solution and the numerical solution for finding y(1) with initial condition y(0)
=1.
b) Plot errors for h = 1, 0.5,0.25..,2-12 and verify that the method is 1st order accurate.
2) Repeat the above exercise by using 4th order Runge-Kutta (programmed by yourself) instead
of Eulers Method
3) Integrate

dy
yt with y (0) 1 and find y (1) using MATLABs ode45 routine. Plot the
dt

numerical solution for t vs y from t= 0 to t=1. Also plot the exact solution in the same range for
comparison.

You might also like