Graphics Programs Reference
In-Depth Information
functionr=residual(u) %Boundaryresidual.
global XSTART XSTOP H
x = XSTART;
[xSol,ySol] = runKut4(@dEqs,x,inCond(u),XSTOP,H);
r = ySol(size(ySol,1),1) - 1;
Here is the solution:
>>
x
y1
y2
0.0000e+000
0.0000e+000
1.5145e+000
2.0000e-001
2.9404e-001
1.3848e+000
4.0000e-001
5.4170e-001
1.0743e+000
6.0000e-001
7.2187e-001
7.3287e-001
8.0000e-001
8.3944e-001
4.5752e-001
1.0000e+000
9.1082e-001
2.7013e-001
1.2000e+000
9.5227e-001
1.5429e-001
1.4000e+000
9.7572e-001
8.6471e-002
1.6000e+000
9.8880e-001
4.7948e-002
1.8000e+000
9.9602e-001
2.6430e-002
2.0000e+000
1.0000e+000
1.4522e-002
Note that
y
(0)
=
1
.
5145,sothatour initial guesses of 1.0 and 2.0 wereon the
mark.
EXAMPLE 8.2
Numerical integration of the initial value problem
y
+
y
(0)
=
=
=
4
y
4
x
y
(0)
0
0
yielded
y
(2)
653 64. Use this information to determine the valueof
y
(0) that
wouldresult in
y
(2)
=
1
.
=
0.
Solution
We use linear interpolation
u
2
−
u
1
u
=
u
2
−
θ
(
u
2
)
θ
(
u
2
)
−
θ
(
u
1
)
y
(0) and
y
(2).Sofar we are given
u
1
=
where in our case
u
=
θ
(
u
)
=
0 and
θ
(
u
1
)
=
1
653 64. To obtain the second point, we needanother solution of the initial value
problem. An obvious solutionis
y
.
0 and
y
(0)
y
(2)
=
x
, which gives us
y
(0)
=
=
=
1.
Thus the second point is
u
2
=
θ
=
1 and
(
u
2
)
1. Linear interpolationnowyields
1
−
0
y
(0)
=
=
−
653 64
=
.
u
1
(1)
2
529 89
1
−
1
.
Since the problemislinear, nofurtheriterations are needed.
Search WWH ::
Custom Search