blob: 3d3ed7f61b767678e7ce7f4050c58c3ed1195ea6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
//Example 15.23
//Milne Simpson Predictor Corrector Method
//Page no. 544
clc;clear;close;
deff('y=f(x,y)','y=y+exp(x)')
h=0.5;
y=[1,1.824,3.718,7.722]
for i=1:4
x=(i-1)*h;
f1(i)=f(x,y(i));
printf('\nf%i = %g',i-1,f1(i))
end
y41=y(1)+4*h*(2*f1(4)-f1(3)+2*f1(2))/3
f4=f(x+h,y41);
y4=y(3)+h*(f4+4*f1(4)+f1(3))/3
printf('\n\n\nPredictor = %.9f\n\n',y41)
printf('Evaluator = %.9f\n\n',f4)
printf('Corrector = %.9f',y4)
|