lanelineLeft(:,1)=1:1:100;
lanelineLeft(:,2)=-(A2L.(lanelineLeft(:,1)).(lanelineLeft(:,1))+A1L.(lanelineLeft(:,1))+A0L);
lanelineRight(:,1)=1:1:100;
lanelineRight(:,2)=A2R.(lanelineRight(:,1)).(lanelineRight(:,1))+A1R.(lanelineRight(:,1))+A0R;
DISMIN=9999;threshold_cnt=0;
for i=1:1:max(xi(:,1))
y1=xi(i,2);
x1=xi(i,3);
DISMIN=9999;
for j=1:1:size(lanelineLeft(:,1))
x2=lanelineLeft(j,1);
y2=lanelineLeft(j,2);
DIS=sqrt((x1-x2)(x1-x2)+(y1-y2)(y1-y2));
if DISMIN>DIS
DISMIN=DIS;
end
end
xi(i,7)=DISMIN;
if DISMIN<2
threshold_cnt=threshold_cnt+1;
xi(i,8)=threshold_cnt;
figure(1);hold on;plot(xi(i,2),xi(i,3),‘bo’);
else
xi(i,8)=0;
end
end
matlab计算距离曲线阈值范围内较近的点
最新推荐文章于 2022-05-29 09:23:20 发布