Milnes Method Matlab Code
Milnes Method Matlab Code
Example 1: Given that and the data y(0)=0, y(0.2)=0.02, y(0.4)=0.0795, y(0.6)=0.1762. Compute y
at x=0.8
clc; clear;
syms f1(x,y) x y
f1(x,y)=x-y^2
f1(x, y) =
x = 1×4
0 0.2000 0.4000 0.6000
y = 1×4
0 0.0200 0.0795 0.1762
xn = 0.8000
h=x(2)-x(1)
h = 0.2000
z=double(f1(x,y))
z = 1×4
0 0.1996 0.3937 0.5690
y4_p=y(1)+4*h/3*(2*z(2)-z(3)+2*z(4))
y4_p = 0.3049
z4=double(f1(xn,y4_p))
z4 = 0.7070
y4_c=y(3)+h/3*(z(3)+4*z(4)+z4)
y4_c = 0.3046
z4=double(f1(xn,y4_c))
z4 = 0.7072
y4_c=y(3)+h/3*(z(3)+4*z(4)+z4)
y4_c = 0.3046
Exercise:
1
1. Apply Milne's method to compute y(1.4) given and the following data y(1)=2, y(1.1)=2.2156,
y(1.2)=2.4649, y(1.3)=2.7514
Ans: 3.0794
Ans: 2.1621