Display a moving graph on a normal figure.
MobilityGraph2Plot(x,y,r,c)
x-coordinates vector.
y-coordinates vector.
node radius used for the display.
node color used for the display.
MobilityGraph2Plot displays a moving network graph (nodes) on a normal figure. Network nodes coordinates x and y are assumed to be known.
scf(1);//creation of a graphic window clf(1); f=gcf(); f.figure_name='MANET'; f.pixmap='on'; //set the pixmap mode //creation of the network boundaries plot2d(0,0,-1,"011"," ",style=5,rect=[0,0,1000,1000]); xgrid; //simulation scenario r=10;//display radius of moving nodes rf=15;//display radius of fixed nodes rs=20;//display radius of the moving nodes belonging to the connection under studies n=50;//quantity of moving nodes nf=5;//quantity of fixed nodes [ndep,nfin]=MobilityRandom_i_j_nf(n,nf);//connection extremal nodes L=1000;//network square area side ts=20;//maximum time break vm=20;//maximum speed v=vm*rand(1,n);//velocity Tlim=1000;//simulation duration nodex=L*rand(1,n+nf);//current x-coordinate of all nodes nodey=L*rand(1,n+nf);//current y-coordinate of all nodes destx=L*rand(1,n+nf);//destination x-coordinate of all nodes(not used for fixed nodes) desty=L*rand(1,n+nf);//destination y-coordinate of all nodes(not used for fixed nodes) d=sqrt((nodex-destx).^2+(nodey-desty).^2);//initialization of the distance vector //display the initial state MobilityGraph2Plot(nodex(nf+1:$),nodey(nf+1:$),r,5);//Application of MobilityGraph2Plot: mobile nodes in red (5) MobilityGraph2Plot(nodex(1:nf),nodey(1:nf),rf,2);//Application of MobilityGraph2Plot: fixed nodes in blue (3) show_pixmap();//display f=gcf();//get the figure properties i=ndep-nf;//emission node in purple (6) f.children.children($-1).children(n-i+1).data(3:4)=[rs rs];//node i f.children.children($-1).children(n-i+1).foreground=6;//node i f.children.children($-1).children(n-i+1).background=6;//node i i=nfin-nf;//destination node in purple (6) f.children.children($-1).children(n-i+1).data(3:4)=[rs rs];//node i f.children.children($-1).children(n-i+1).foreground=6;//node i f.children.children($-1).children(n-i+1).background=6;//node i show_pixmap();//display | ![]() | ![]() |