I have 25 nodes that need 50 (random) connections. Below my code, any suggestions?
figure; load('usborder.mat','x','y','xx','yy'); rng(6,'twister') nStops = 25;stopsLon = zeros(nStops,1); stopsLat = stopsLon;n = 1;while (n <= nStops) xp = rand*1.5; yp = rand; if inpolygon(xp,yp,x,y) stopsLon(n) = xp; stopsLat(n) = yp; n = n+1; endendplot(x,y,'k--');hold onplot(stopsLon,stopsLat,'xr')hold off
Best Answer