Graphics Programs Reference
In-Depth Information
functionF=fex7
8(x,y)
% Diff. eqs. used in Example 7.8
F = zeros(1,2);
F(1) = y(2);
F(2) = -9.80665...
+ 65.351e-3 * y(2)ˆ2 * exp(-10.53e-5 * y(1));
_
The commandsforperforming the integration and displaying the results are
shown below. Wespecifiedaper-step error tolerance of 10 2 in runKut5 .Consid-
ering the magnitudeof y ,this shouldbeenoughforfive decimal point accuracyinthe
solution.
_
>> [x,y] = runKut5(@fex7
8,0,[9000 0],10,0.5,1.0e-2);
>> printSol(x,y,1)
Execution of the commands resultedinthe following output:
>>
x
y1
y2
0.0000e+000
9.0000e+003
0.0000e+000
5.0000e-001
8.9988e+003 -4.8043e+000
1.9246e+000
8.9841e+003 -1.4632e+001
3.2080e+000
8.9627e+003 -1.8111e+001
4.5031e+000
8.9384e+003 -1.9195e+001
5.9732e+000
8.9099e+003 -1.9501e+001
7.7786e+000
8.8746e+003 -1.9549e+001
1.0000e+001
8.8312e+003 -1.9519e+001
The first integration stepwascarried out with the prescribed trial value h
=
0
5 s. Apparently the errorwas well within the tolerance,sothat the stepwas accepted.
Subsequent step sizes, determined fromEq. (7.24), wereconsiderably larger.
Inspecting the output, we see that at t
.
=
10 s the object is moving with the speed
=−
=
.
=
v
y
19
52 m/s at an elevation of y
8831 m.
EXAMPLE 7.9
Integrate the moderately stiff problem
19
4
y =−
10 y
y (0)
y
y (0)
=−
9
=
0
=
from x
0to10 with the adaptive Runge-Kuttamethod and plot the results (this
problemalso appeared in Example 7.7).
Search WWH ::




Custom Search