0% found this document useful (0 votes)
54 views1 page

A0 - Numerical Methods Assignment

1) Write a program to solve the ODE dy/dt = -ty using Euler's method. Test the program by plotting the exact and numerical solutions for finding y(1) with y(0)=1, and plot the errors for various time steps to verify it is first order accurate. 2) Repeat the above using a 4th order Runge-Kutta method instead of Euler's method. 3) Integrate the same ODE dy/dt = -ty from t=0 to t=1 with y(0)=1 using MATLAB's ode45 routine. Plot the numerical and exact solutions for comparison.

Uploaded by

Deepanshu Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views1 page

A0 - Numerical Methods Assignment

1) Write a program to solve the ODE dy/dt = -ty using Euler's method. Test the program by plotting the exact and numerical solutions for finding y(1) with y(0)=1, and plot the errors for various time steps to verify it is first order accurate. 2) Repeat the above using a 4th order Runge-Kutta method instead of Euler's method. 3) Integrate the same ODE dy/dt = -ty from t=0 to t=1 with y(0)=1 using MATLAB's ode45 routine. Plot the numerical and exact solutions for comparison.

Uploaded by

Deepanshu Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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