手把手教用matlab做无人驾驶(十七)--arc-length 重参数化

 

 

这里的内容请参考: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')

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值