方法描述(matlab 2016a):
Vq = interp1(X,V,Xq,METHOD) specifies the interpolation method.
The available methods are:
'linear' - (default) linear interpolation
'nearest' - nearest neighbor interpolation
'next' - next neighbor interpolation
'previous' - previous neighbor interpolation
'spline' - piecewise cubic spline interpolation (SPLINE)
'pchip' - shape-preserving piecewise cubic interpolation
'cubic' - same as 'pchip'
'v5cubic' - the cubic interpolation from MATLAB 5, which does not
extrapolate and uses 'spline' if X is not equally
spaced.
m代码:
X = 0:10; V = sin(X); Xq = 0:.25:10;
Vq = interp1(X,V,Xq,'linear'); % 'linear' 替换为其他方法
figure;plot(X,V,'o',Xq,Vq,':.')
结果记录:
(1)'linear'
(2)'nearest'
(3) 'next'
(4) 'previous'
(5)'spline'
(6) 'pchip'
(7)'cubic'
(8)'v5cubic'
测试版本:matlab2016a 注意'cubic'在后续版本效果更改