Documente Academic
Documente Profesional
Documente Cultură
= ti (1 x2i )e2xi
k2
1
1
1
= (ti + h)(1 (xi + k1 h)2 )e2(xi + 2 k1 h)
2
2
k3
1
1
1
= (ti + h)(1 (xi + k2 h)2 )e2(xi + 2 k2 h)
2
2
k4
(a)
(b)
(c)
(d)
(e)
Solution:
(a) Using the explicit Eulers method with h = 0.1.
xi+1 = xi +
i
0
1
2
3
4
5
ti
1.0
1.1
1.2
1.3
1.4
1.5
xi + t2i
h
ti
xi
1.0000
1.2000
1.4191
1.6573
1.9148
2.1916
xi+1 + t2i+1
h
ti+1
ti+1 xi + t2i+1 h
ti+1 h
ti
1.0
1.1
1.2
1.3
1.4
1.5
xi
1.0000
1.2210
1.4629
1.7257
2.0092
2.3134
xi + t2i
h
ti
xi+1 = xi +
xoi+1 + t2i+1
h
ti+1
xoi+1 + xi+1
2
xi+1 =
2
i ti
0 1.0
1 1.3
2 1.5
xoi+1
N/A
1.5000
2.1800
xi+1
xi
N/A 1.0000
1.6125 1.5562
2.2946 2.2373
xi + t2i
ti
k2
k3
k4
1
xi+1 = xi + (k1 + 2k2 + 2k3 + k4 )h
6
i ti
k1
0 1.0 N/A
1 1.5 2.0000
k2
k3
N/A
N/A
2.4500 2.5400
k4
xi
N/A 1.0000
3.0133 2.2494
(e) Write a MATLAB code, which uses explicit Eulers method to compute x(10), with h=0.01.
Please print out the plot for t [1, 10] and the final result x(10) as well.
Sample program:
h=0.01;
t=1:h:10;
n=length(t);
x(1)=1;
for i=1:n-1
x(i+1)=x(i)+h*Func4_2(t(i),x(i));
end
plot(t,x,b-,linewidth,3);
title(Fourth-order Runge-Kutta Method,fontsize,24);
xlabel(t,fontsize,24)
ylabel(x,fontsize,24)
Plot:
90
80
70
60
50
40
30
20
10
t
3. Consider the following system of ordinary differential equations:
dx1
= 0.5x1 + 0.3x2
dt
dx2
= 4 0.3x2 + 0.1x1
dt
with x1 (0) = 2 and x2 (0) = 1. Estimate x1 (2) and x2 (2)
(a) Using the explicit Eulers method with h = 0.5.
(b) Using the Euler predictor-corrector with h = 1.0.
(c) Using the fourth-order Runge-Kutta method with h = 2.0.
Solutions:
(a) Using the explicit Eulers method with h = 0.5.
x1,i+1 = x1,i + (0.5x1,i + 0.3x2,i )h
x2,i+1 = x2,i + (4 0.3x2,i + 0.1x1,i )h
i
0
1
2
3
4
ti
0.0
0.5
1.0
1.5
2.0
x1,i
2.0000
1.6500
1.6800
1.9485
2.3592
4
x2,i
1.0000
2.9500
4.5900
5.9855
7.1851
10
xo1,i+1 + x1,i+1
=
2
x2,i+1 =
i
0
1
2
ti
xo1,i+1
2.0 N/A
1.0 1.3000
2.0 2.3140
xo2,i+1
N/A
4.9000
7.2020
xo2,i+1 + x2,i+1
2
x1,i+1
N/A
2.8200
3.0636
x2,i+1
x1,i
x2,i
N/A 2.0000 1.0000
3.6600 2.0600 4.2800
6.3508 2.6888 6.7764
1
x1,i+1 = x1,i + (k1,1 + 2k1,2 + 2k1,3 + k1,4 )h
6
1
x2,i+1 = x1,i + (k2,1 + 2k2,2 + 2k2,3 + k2,4 )h
6
i
0
1
ti
k1,1
2.0 N/A
2.0 -0.700
k2,1
k1,2
k2,2
k1,3
N/A N/A N/A N/A
3.900 0.820 2.660 -0.312
k2,3
N/A
3.184
k1,4
N/A
1.522
k2,4
x1,i
x2,i
N/A 2.000 1.000
1.927 2.613 6.838
+
2
= et x
dt3
dt2
dt
d2 x
dx
with x(t0 ) = a,
(t0 ) = b and 2 (t0 ) = c. Reduce the above equation to a form that can be
dt
dt
treated by the methods learned in class.
Solutions:
Define:
x1 = x
x2 =
dx
dt
x3 =
d2 x
dt2