l have generated a topology of a network with 200 nodes.than l want to draw a circle with black color around a choosen node(satisfying a certain condition IF (condition) ). to simplify let the user introduce the the index of the node to circle with the black color. here is my code of the generated topology.l need to add wich instructions to draw the circle around the choosen node ?
X=100; Y=100; N=200; %number of nodes
nodesX(1)=rand*X; nodesY(1)=rand*Y; for i=2:N nodesX(i)=rand*X; nodesY(i)=rand*Y; d(i-1) =((nodesX(i)-nodesX(i-1)).^2+(nodesY(i)-nodesY(i-1)).^2).^0.5; while (d(i-1)>200) nodesX(i)=rand*X; nodesY(i)=rand*Y; d(i-1) =((nodesX(i)-nodesX(i-1)).^2+(nodesY(i)-nodesY(i-1)).^2).^0.5; end end h_old=plot(nodesX,nodesY,'m*'); labels=[1:N]'; labels=num2str(labels); text(nodesX,nodesY,labels); xlabel('X (Meters)'); ylabel('Y (Meters)'); title(['Network Topology with',num2str(N),'nodes']); hold on for k=1:N; for j=1:N; if (k~=j) d=((nodesX(k)-nodesX(j))^2+(nodesY(k)-nodesY(j))^2)^0.5; end if (k~=j); if(d < 50); line([nodesX(k),nodesX(j)],[nodesY(k),nodesY(j)]); end end end; end;
Best Answer