例子
在MATLAB中输入下面命令:
>> x=[0 1.2 3.6 4.8 8.4 10.8 13.2 14.4 16.8 18]
x =
Columns 1 through 8
0 1.2000 3.6000 4.8000 8.4000 10.8000 13.2000 14.4000
Columns 9 through 10
16.8000 18.0000
>> y=[3.3 3.825 5.025 5.625 6.9 7.56 7.89 8.4 8.28 7.875]
y =
Columns 1 through 8
3.3000 3.8250 5.0250 5.6250 6.9000 7.5600 7.8900 8.4000
Columns 9 through 10
8.2800 7.8750
>> pp=spline(x,y);
>> [nodes codes]=unmkpp(pp)
nodes =
Columns 1 through 8
0 1.2000 3.6000 4.8000 8.4000 10.8000 13.2000 14.4000
Columns 9 through 10
16.8000 18.0000
codes =
-0.0026 0.0299 0.4054 3.3000
-0.0026 0.0205 0.4659 3.8250
-0.0147 0.0017 0.5191 5.0250
0.0060 -0.0511 0.4598 5.6250
-0.0149 0.0141 0.3268 6.9000
0.0387 -0.0930 0.1375 7.5600
-0.1103 0.1860 0.3606 7.8900
0.0219 -0.2110 0.3306 8.4000
0.0219 -0.0536 -0.3046 8.2800