blob: a0c5ba8aec4f912e13ef1fd843af89dd962ae307 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
//clc()
disp("f(x,y) = 4*exp(0.8*x) - 0.5*y")
//f'(x,y) = 4*exp(0.8*x) - 0.5*y
h =2;
x = 0:h:2;
y(1) = 2;
t = 14.84392;
k1 = 4*exp(0.8*x(1)) - 0.5*y(1);
x1 = x(1) + h/5;
y1 = y(1) + k1*h/5;
k2 = 4*exp(0.8*x1) - 0.5*y1;
x1 = x(1) + 3*h/10;
y1 = y(1) + 3*k1*h/40 + 9*k2*h/40;
k3 = 4*exp(0.8*x1) - 0.5*y1;
x1 = x(1) + 3*h/5;
y1 = y(1) + 3*k1*h/10 - 9*k2*h/10 + 6*k3*h/5;
k4 = 4*exp(0.8*x1) - 0.5*y1;
x1 = x(1) + h;
y1 = y(1) -11*k1*h/54 + 5*k2*h/2 - 70*k3*h/27 + 35*k4*h/27;
k5 = 4*exp(0.8*x1) - 0.5*y1;
x1 = x(1) + 7*h/8;
y1 = y(1) + 1631*k1*h/55296 + 175*k2*h/512 + 575*k3*h/13824 + 44275*k4*h/110592 +253*k5*h/4096;
k6 = 4*exp(0.8*x1) - 0.5*y1;
y1 = y(1) + (37*k1/378 + 250*k3/621 + 125*k4/594 + 512*k6/1771)*h;
y2 = y(1) + (2825*k1/27648 + 18575*k3/48384 + 13525*k4/55296 + 277*k5/14336 + k6/4)*h;
disp(y1,"y ( fourth order prediction ) = ")
disp(y2,"y ( fifth order prediction ) = ")
|