Matlab : Euler Formula and Runga-Kutta Fourth Order
I am posting formula called Runge Kutta Fourth Order. This formula need to be written in a matlab program.
I attached sample program how to generate euler formula in mathlab. Based on this program, can any one send matlab program for Runga Kutta Fourth Order?
See attached files for full problem description.
This question has the following supporting file(s):
- euler_putcha.asv.txt
- euler_putcha.m.txt
- fun.m.txt
- Numerical Analysis(8th Edition) page 278.jpg
- Numerical Analysis(8th Edition) page 279.jpg
Solution Summary
The Euler Formula is formulated as a Runga-Kutta Fourth Order problem in Matlab.
This answer includes:
- Plain text
- Cited sources when necessary
Extracted Content from Question Files:
- euler_putcha.asv.txt
function z= euler_putc(a,b,y0,h,maxits)
t(1)=a;
w(1)=y0;
i=a;
while i<=b && i<=maxits
w(i)=w(i-1) + h * fun(t,w(i-1));
t(i)=a + i * h;
end
z = [t;w]
- euler_putcha.m.txt
function z= euler_putcha(a,b,y0,h,maxits)
t(1)=a;
w(1)=y0;
k=a;
while k<=b && k<=maxits
w(k)=w(k-1)+h*fun(t,w(k-1));
t(k)=a+k*h;
end
z = [t;w]
- fun.m.txt
function z = fun(t,y)
z = y/t-(y/t)^2;
