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
只能做到這一步了,關于染色,就不會了……
總結
以上是生活随笔為你收集整理的matlab路面,赛道道路路况分析问题 matlab高手进下的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php实现多商家开发,Thinkphp5
- 下一篇: linux导出文件夹到u盘,Linux系