Matlab插值拟合
https://zhuanlan.zhihu.com/p/73931917
spline: 3次样条插值。每一个分段你内构造一个三次多项式,使其插值函数除满足插值条件外,还要求在各节点处具有连续的一阶和二阶导数。
linear为双线性插值算法(默认算法),nearest为最临近插值,spline为三次样条插值,cubic为双三次插值。
3次埃尔米特插值和3次样条插值都能保证曲线的光滑性
>> x = [0,3,5,7,9,11,12,13,14,15];
>> y = [0,1.2,1.7,2.0,2.1,2.0,1.8,1.2,1.0,1.6];
>> x1 = 0:0.1:15;
>> y1 = interp1(x,y,x1,'spline'); %cubic也可
>> plot(x1,y1)
y1=
0 0.0499 0.0990 0.1474 0.1951 0.2421 0.2884 0.3340 0.3788 0.4230 0.4665 0.5094
Columns 13 through 24
0.5515 0.5930 0.6338 0.6739 0.7134 0.7523 0.7904 0.8280 0.8649 0.9012 0.9368 0.9719
Columns 25 through 36
1.0063 1.0401 1.0732 1.1058 1.1378 1.1692 1.2000 1.2302 1.2599 1.2889 1.3174 1.3454
Columns 37 through 48
1.3727 1.3995 1.4258 1.4515 1.4767 1.5014 1.5255 1.5491 1.5722 1.5947 1.6168 1.6383
Columns 49 through 60
1.6594 1.6799 1.7000 1.7196 1.7387 1.7573 1.7754 1.7930 1.8102 1.8269 1.8430 1.8588
Columns 61 through 72
1.8740 1.8887 1.9030 1.9168 1.9301 1.9430 1.9553 1.9672 1.9786 1.9895 2.0000 2.0100
Columns 73 through 84
2.0195 2.0285 2.0370 2.0450 2.0525 2.0595 2.0660 2.0719 2.0773 2.0822 2.0865 2.0902
Columns 85 through 96
2.0933 2.0959 2.0979 2.0994 2.1002 2.1004 2.1000 2.0990 2.0974 2.0952 2.0925 2.0893
Columns 97 through 108
2.0857 2.0815 2.0770 2.0721 2.0668 2.0611 2.0552 2.0490 2.0425 2.0358 2.0289 2.0219
Columns 109 through 120
2.0147 2.0074 2.0000 1.9924 1.9841 1.9742 1.9621 1.9469 1.9280 1.9046 1.8759 1.8413
Columns 121 through 132
1.8000 1.7516 1.6970 1.6377 1.5749 1.5099 1.4442 1.3790 1.3157 1.2556 1.2000 1.1501
Columns 133 through 144
1.1063 1.0687 1.0377 1.0134 0.9960 0.9857 0.9828 0.9875 1.0000 1.0205 1.0492 1.0863
Columns 145 through 151
1.1320 1.1866 1.2503 1.3233 1.4057 1.4979 1.6000
发表评论: