資源簡介
元胞自動機交通流模型matlab代碼,雙車道模型,靠右行駛模型,代碼很容易修改成其他相關模型。

代碼片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%A?Two-Lane?Cellular?Automaton?Traffic?Flow?Model?with?the?Keep-Right?Rule
%edited?by?Milky?ZhangImage?Information?Institute?in?Sichuan?Universiyt?2014/2/14
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;
clear?all;
close?all;
B=2;?????????????%The?number?of?the?lanes
plazalength=50;??%The?length?of?the?simulating?highways
h=NaN;???????????%h?is?the?handle?of?the?image
[plazav]=create_plaza(Bplazalength);
h=show_plaza(plazah0.1);
iterations=1000;????%?迭代次數
probc=0.1;??????????%?車輛的密度
probv=[0.1?1];??????%?兩種車流的密度分布
probslow=0.3;???????%?隨機慢化的概率
Dsafe=1;????????????%?表示換道事車至少與后面車距離多少個單位才算安全
VTypes=[12];???????%道路上一共有幾種最大速度不同的車輛速度是什么
[plazavvmax]=new_cars(plazavprobcprobvVTypes);%一開始就在車道上布置車輛,做周期循環駕駛,也方便觀察流量密度之間的關系
size(find(plaza==1))
PLAZA=rot90(plaza2);
h=show_plaza(PLAZAh0.1);
for?t=1:iterations;
????size(find(plaza==1))
????PLAZA=rot90(plaza2);
????h=show_plaza(PLAZAh0.1);
????[vgapLUPLDOWN]=para_count(plazavvmax);
????[plazavvmax]=switch_lane(plazavvmaxgapLUPLDOWN);
????[plazavvmax]=random_slow(plazavvmaxprobslow);
????[plazavvmax]=move_forward(plazavvmax);
end
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1383??2015-01-09?13:27??cellular?automata\cellular.m
?????文件????????148??2014-08-09?23:31??cellular?automata\create_plaza.m
?????文件???????1386??2014-08-09?23:30??cellular?automata\move_forward.m
?????文件???????1786??2014-08-09?23:30??cellular?automata\new_cars.m
?????文件???????1782??2014-08-09?23:30??cellular?automata\para_count.m
?????文件????????341??2014-08-09?23:30??cellular?automata\random_slow.m
?????文件????????310??2015-01-09?13:28??cellular?automata\Readme.txt
?????文件????????604??2014-08-09?23:30??cellular?automata\show_plaza.m
?????文件???????1747??2014-08-09?23:30??cellular?automata\switch_lane.m
?????目錄??????????0??2014-08-09?23:31??cellular?automata
-----------?---------??----------?-----??----
?????????????????9487????????????????????10
評論
共有 條評論