Anda di halaman 1dari 4

octave:1> ex_complete

n = 3
k = 3
xi =

1 3 4 7

a = 1
b = 7
xi_ext =

-2 -1 0 1 3 4 7 8 9 10

a =

-0.50000
0.33333
0.00000
0.00000
0.00000
0.00000

debug> exit
a =

-0.50000 0.25000
0.33333 0.58333
0.00000 0.08333
0.00000 0.00000
0.00000 0.00000
0.00000 0.00000

debug> exit
a =

-0.50000 0.25000 0.25000


0.33333 0.58333 0.08333
0.00000 0.08333 0.69444
0.00000 0.00000 0.37500
0.00000 0.00000 0.00000
0.00000 0.00000 0.00000

debug> exit
a =

-0.50000 0.25000 0.25000 0.00000


0.33333 0.58333 0.08333 0.00000
0.00000 0.08333 0.69444 0.22222
0.00000 0.00000 0.37500 0.57500
0.00000 0.00000 0.00000 0.05000
0.00000 0.00000 0.00000 -0.15000

debug> exit
a =

-0.50000 0.25000 0.25000 0.00000 0.00000


0.33333 0.58333 0.08333 0.00000 0.00000
0.00000 0.08333 0.69444 0.22222 0.00000
0.00000 0.00000 0.37500 0.57500 0.05000
0.00000 0.00000 0.00000 0.05000 0.50000
0.00000 0.00000 0.00000 -0.15000 -0.30000

debug> exit
a =

-0.50000 0.25000 0.25000 0.00000 0.00000 0.00000


0.33333 0.58333 0.08333 0.00000 0.00000 0.00000
0.00000 0.08333 0.69444 0.22222 0.00000 0.00000
0.00000 0.00000 0.37500 0.57500 0.05000 0.00000
0.00000 0.00000 0.00000 0.05000 0.50000 0.45000
0.00000 0.00000 0.00000 -0.15000 -0.30000 0.45000

debug> exit
b =

0
2
6
4
1
-2

x =

4.079365
-0.079365
8.238095
1.285714
3.428571
-1.730159

debug> exit
octave:2>

octave:1> ex_notaknot
debug>
octave:1> ex_notaknot
debug> exit
a =

0.45000 0.51429
0.01667 0.46349
0.00000 0.21429
0.00000 0.00000
0.00000 0.00000
0.00000 0.00000

debug> exit
a =

0.45000 0.51429 0.03571


0.01667 0.46349 0.46429
0.00000 0.21429 0.59821
0.00000 0.00000 0.10000
0.00000 0.00000 0.01250
0.00000 0.00000 0.00000

debug> exit
a =

0.45000 0.51429 0.03571 0.00000


0.01667 0.46349 0.46429 0.05556
0.00000 0.21429 0.59821 0.18750
0.00000 0.00000 0.10000 0.60000
0.00000 0.00000 0.01250 0.33194
0.00000 0.00000 0.00000 0.05556

debug> exit
a =

0.45000 0.51429 0.03571 0.00000 0.00000


0.01667 0.46349 0.46429 0.05556 0.00000
0.00000 0.21429 0.59821 0.18750 0.00000
0.00000 0.00000 0.10000 0.60000 0.30000
0.00000 0.00000 0.01250 0.33194 0.61389
0.00000 0.00000 0.00000 0.05556 0.61111

debug> exit
a =

0.45000 0.51429 0.03571 0.00000 0.00000 0.00000


0.01667 0.46349 0.46429 0.05556 0.00000 0.00000
0.00000 0.21429 0.59821 0.18750 0.00000 0.00000
0.00000 0.00000 0.10000 0.60000 0.30000 0.00000
0.00000 0.00000 0.01250 0.33194 0.61389 0.04167
0.00000 0.00000 0.00000 0.05556 0.61111 0.33333

debug> exit
b =

2
6
4
1
0
2

x =

-8.1608
10.8852
2.0789
2.2602
-1.8801
9.0702

debug> exit
octave:2> quit
[johnson@hp octave]$ cd ../matlab/
[johnson@hp matlab]$ octave -q
octave:1> ex_splinecompare
the obtained natural, complete, and not-a-knot splines are
represented by (x1,s1), (x2,s2), and (x3,s3), respectively.
here are plots of the error between f and the three splines
debug> exit
here are plots of the error between f and the complete and not-a-knot splines
octave:2> who

*** dynamically linked functions:

min

*** currently compiled functions:

b_spline __pltopt__ isscalar notaknot_spline pp_integ


__plt2__ bb2pp isstr plot pp_val
__plt2vv__ columns isvector polyval rows
__plt__ complete_spline natural_spline pp_deriv

*** local user variables:

n s2 x1 x3 __nargin__ y y1
y3
s1 s3 x2 xi k y0 y2
z

octave:3> max(y2)
ans = 0.99997
octave:4> max(y2-y0)
ans = 0.00010558
octave:5> max(abs(y2-y0))
ans = 0.00013608
octave:6> quit
[johnson@hp matlab]$ gedit ex_splinecompare.m &
[1] 3606
[johnson@hp matlab]$ octave -q
octave:1> ex_splinecompare
the obtained natural, complete, and not-a-knot splines are
represented by (x1,s1), (x2,s2), and (x3,s3), respectively.
here are plots of the error between f and the three splines
debug> exit
here are plots of the error between f and the complete and not-a-knot splines
octave:2> max(abs(y2-y0))
ans = 1.1770e-06
octave:3> .03/8
ans = 0.0037500
octave:4> .00013/64
ans = 2.0312e-06
octave:5> quit
[1]+ done gedit ex_splinecompare.m
[johnson@hp matlab]$

Anda mungkin juga menyukai