matlab导入真实路况,赛道道路路况分析问题 matlab高手进下

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

clf;clear

x1=[0.2,4.96,6.55,9.71,13.17,16.23,18.36,20.53,23.15,26.49,28.23,29.1,30.65,30.92,31.67,33.03,34.35,35.01,37.5]

x2=[0.2,1.8,4.90,6.51,9.73,13.18,16.20,18.92,20.50,23.23,25.56,28.31,29.45,30.30,30.92,31.67,33.31,34.23,35.81,37.5]

y1=[6.66,5.28,4.68,5.19,2.34,6.94,5.55,9.86,5.28,3.87,3.04,2.88,3.68,2.38,2.06,2.58,2.16,1.45,6]

y2=[6.66,19.89,24.52,34.82,40.54,37.67,41.38,30.00,19.68,14.56,18.86,18.55,22.66,18.28,15.06,13.42,11.86,7.68,9.45,6]

T=0:0.25:9

v1=4*sqrt((x1(2:19)-x1(1:18)).^2+(y1(2:19)-y1(1:18)).^2)

v2=4*sqrt((x2(20:-1:2)-x2(19:-1:1)).^2+(y2(20:-1:2)-y2(19:-1:1)).^2)

v=[v1,v2]

%画出车道!

subplot(1,2,1)

plot(x1,y1,'r.','markersize',15);

hold on

plot(x2,y2,'k.','markersize',15);

hold on

axis([-5 40 0 45]);

grid;hold on

xlabel('x')

ylabel('y')

title('模拟赛道')

t=-5:0.25:40

u1=spline(x1,y1,t);

plot(t,u1,'b-','linewidth',3)

hold on

u2=spline(x2,y2,t);

plot(t,u2,'b-','linewidth',3)

%画出速度曲线!

subplot(1,2,2)

plot(T,v,'g.','markersize',15);

hold on

axis([0 9 0 55])

grid;hold on

xlabel('时间t/h')

ylabel('速度v/km/h')

title('速度随时间变化曲线')

text(0.1,13,'va=12')

text(0.1,31,'vb=30')

t0=0:0.05:9

w=spline(T,v,t0)

plot(t0,w,'g-','linewidth',3)

hold on

va=12

vb=30

plot(t0,va,'r-','linewidth',3)

hold on

plot(t0,vb,'r-','linewidth',3)

hold on

x=4.5

y=15.3668

plot(x,y,'k.','markersize',15)

%求周长与面积!

s=trapz(t,u2-u1);

p1=sqrt(diff(t).^2+diff(u1).^2);

p2=sqrt(diff(t).^2+diff(u2).^2);

l=sum(p1)+sum(p2);

fprintf('s=%.2f,l=%.2f\n',s,l)

hold on

只能做到这一步了,关于染色,就不会了……

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值