Professional Documents
Culture Documents
Table of Contents
INPUT .............................................................................................................................. 1
PROGRAM & RESULT ...................................................................................................... 1
SOLVER ........................................................................................................................... 1
INPUT
SC_RK2(@(x,y)x+y,0,1,2,0.5)
n=(xn-x0)/h;
for i=1:1:n
s1=h*feval(fun,x0,y0);
s2=h*feval(fun,x0+h,y0+s1);
s=(s1+s2)/2;
y0=y0+s;
x0=x0+h;
end
fprintf('The value obtained is: %f\n',y0);
SOLVER
[x,y]=ode45(@(x,y)x+y,[0:0.5:2],1)
x =
0
0.5000
1.0000
1.5000
2.0000
y =
1.0000
1.7974
3.4366
1
RUNGE KUTTA 2ND ORDER
6.4634
11.7781