[参考文献]:Huang, Tenglong & Pan, Huihui & Zhang, Chi & Sun, Weichao. (2020). Path Planning and Fault-tolerant Control Based on Resistance Network for Autonomous Driving. 158-162. 10.1109/CVCI51460.2020.9338441.
Matlab代码实现:
x1=20;
x2=80;
y1=0;
y2=20;
xp=0:0.05:100;
yp=zeros(1,length(xp));
for i=1:length(xp)
if xp(i)<x1
yp(1,i)=y1;
end
if xp(i)>=x1 && xp(i)<x2
yp(1,i)=(y1+y2)/2*sin(pi/(x2-x1)*(xp(i)-(x1+x2)/2))+(y1+y2)/2;
end
if xp(i)>=x2
yp(1,i)=y2;
end
end
plot(xp,yp,'linewidth',2)