Graphics Programs Reference
In-Depth Information
1930 T . Thus the interpolant and its deri-
which yields a
=
0
.
7714 1
.
5075
0
.
vatives are
1903 x 2
P 2 ( x )
=−
0
.
+
1
.
5075 x
0
.
7714
P 2 ( x )
=−
0
.
3860 x
+
1
.
5075
P 2 ( x )
=−
0
.
3860
which gives us
f (2) P 2 (2)
=−
0
.
3860(2)
+
1
.
5075
=
0
.
7355
f (2)
P 2 (2)
=−
0
.
3860
Solution of Part (2) We must first determine the second derivatives k i of the spline
at its knots, afterwhich the derivatives of f ( x )can becomputed fromEqs. (5.10) and
(5.11). The first partcan becarried out by the following small program:
% Example 5.4 (Curvatures of cubic spline at the knots)
xData = [1.5; 1.9; 2.1; 2.4; 2.6; 3.1];
yData = [1.0628; 1.3961; 1.5432; 1.7349; 1.8423; 2.0397];
k = splineCurv(xData,yData)
The outputoftheprogram,consisting of k 1 to k 6 , is
>>k=
0
-0.4258
-0.3774
-0.3880
-0.5540
0
Since x
=
2 lies between knots 2 and 3, we must use Eqs. (5.10) and (5.11) with
i
=
2. This yields
3( x
x 3 )
x 3 ) 2
k 2
6
f (2) f 2 , 3 (2)
=
( x 1
x 2
x 3
3( x
x 3 )
x 2 ) 2
k 3
6
y 2
y 3
( x 2
+
x 2
x 3
x 2
x 3
Search WWH ::




Custom Search