这里的内容请参考:https://www.zhihu.com/search?type=content&q=Arc-Length%20Parameterized%20Spline%20Curves
在Matlab中的仿真程序与效果:
clc
clear
R=5;
x1=[];
y1=[];
x2=[];
y2=[];
for t=0:0.1:sqrt(2*pi)
x1=[x1 R*cos(t*t)]
y1=[y1 R*sin(t*t)]
end
for t1=0:1:2*pi*R
x2=[x2 R*cos(t1/R)]
y2=[y2 R*sin(t1/R)]
end
figure(1)
plot(x1,y1,'or')
hold on
plot(x2,y2,'ob')
分段三次 Hermite 插值多项式 (PCHIP)与三次样条插值(SPLINE)的区别
Comparison of SPLINE, PCHIP, and MAKIMA:
% - All three are a form of piecewise cubic Hermite interpolation,
% but each function computes the slopes of YQ at X(j) differently.
% - SPLINE chooses slopes at X(j) such that the second derivative of
% YQ is continuous. Therefore, SPLINE is smoother and more accurate
% if the Y data represents values of a smooth function.
% - PCHIP has no overshoots and less oscillation than SPLINE.
% - MAKIMA has less oscillation than SPLINE but may have overshoots.
% - PCHIP and MAKIMA are less expensive than SPLINE to set up PP.
% - All three are equally expensive to evaluate.
% - SPLINE and MAKIMA generalize to n-D grids. See INTERPN.
MATLAB代码例子:
x = [1 2 3 4 5 5.5 7 8 9 9.5 10];
y = [0 0 0 0.5 0.4 1.2 1.2 0.1 0 0.3 0.6];
xq = 0.75:0.05:10.25;
yqs = spline(x,y,xq);
yqp = pchip(x,y,xq);
yqm = makima(x,y,xq);
plot(x,y,'ko','LineWidth',2,'MarkerSize',10)
hold on
plot(xq,yqp,'LineWidth',4)
plot(xq,yqs,xq,yqm,'LineWidth',2)
legend('(x,y) data','pchip','spline','makima')