Graphics Programs Reference
In-Depth Information
d(3,1) = d(2,2);
d(3,2) = -0.001*y(2) - 0.01*x + 0.1;
d(4,1) = d(3,2);
d(4,2) = 0.0001*y(2) + 0.001*x - 0.01;
Here is the solution:
>> [x,y] = taylor(@fex7
_
2, 0, [0 1], 2, 0.25);
>> printSol(x,y,1)
x
y1
y2
0.0000e+000
0.0000e+000
1.0000e+000
2.5000e-001
2.4431e-001
9.4432e-001
5.0000e-001
4.6713e-001
8.2829e-001
7.5000e-001
6.5355e-001
6.5339e-001
1.0000e+000
7.8904e-001
4.2110e-001
1.2500e+000
8.5943e-001
1.3281e-001
1.5000e+000
8.5090e-001 -2.1009e-001
1.7500e+000
7.4995e-001 -6.0625e-001
2.0000e+000
5.4345e-001 -1.0543e+000
The analytical solution of the problemis
5 x 2
990( e 0 . 1 x
y
=
100 x
+
1)
543 45 and y (2)
fromwhich weobtain y (2)
=
0
.
=−
1
.
0543, which agree with the nu-
merical solution.
The main drawback of the Taylor series methodisthat it requires repeateddiffer-
entiation of the dependent variables. These expressions may become very long and
thuserror-prone and tedioustocompute. Moreover, there is the extra workofcoding
each of the derivatives.
7.3
Runge-Kutta Methods
The aim of Runge-Kuttamethods istoeliminate the need forrepeateddifferentiation
of the differentialequations.Since nosuch differentiationis involvedinthe first-order
Taylor series integration formula
y ( x ) h
y ( x
+
h )
=
y ( x )
+
=
y ( x )
+
F ( x
,
y ) h
(7.8)
itcan beconsideredas the first-order Runge-Kuttamethod; it is also called Euler's
method .Duetoexcessivetruncation error,this methodis rarelyusedinpractice.
Search WWH ::




Custom Search