image thumbnail

VANET node - RoadSide Unit scenario simulations

by

 

This file contains matlab simulations of nodal interaction scenarios in VANETs

IntersectionDrawRoads.m
axis([0 100 0 100]);
[x,y] = ginput(2);
line(x,y,'color','k'); 
hold on

[p,q] = ginput(2);
line(p,q,'color','k'); 

a1 = linspace(x(1),x(2),10);
b1 = linspace(y(1),y(2),10);

a2 = linspace(p(1),p(2),10);
b2 = linspace(q(1),q(2),10);

for i = 1:1000
    t1x = (rem(i,10)+1);
    t1y = (rem(i,10)+1);
    t2x = (rem(i,10)+1);
    t2y = (rem(i,10)+1);

h1 = plot(a1(t1x),b1(t1y),'*r')
h2 = plot(a2(t2x),b2(t2y),'*g')
h3 = plot([a1(t1x) a2(t2x)],[b1(t1y) b2(t2y)])
pause(0.5);
set(h1,'Visible','off')
set(h2,'Visible','off')
set(h3,'Visible','off')
end

Contact us