你好,我想问一个问题:如何在MATLAB中绘制圆并标出其圆心,并生成一定数量的随机点,例如50个?我知道用以下代码可以画出圆:
x = linspace(-sqrt(10),sqrt(10));
y1 = sqrt(10-x.^2);
y2 = -sqrt(10-x.^2);
plot(x,y1,x,y2)
axis equal
hold on
但我不知道如何在其中生成50个随机点, 然后我想到了这个伪代码,但我不知道如何用matlab编写它。
01: FOR all nodes j
02: FOR all nodes i except node j
03: IF distance(j to center) < distance(j to i) AND
04: distance(i to cell center) < distance(j to i)
05: THEN there's a red link from node i to node j
06: ELSEIF distance(j to cell center) < distance(j to i)
07: THEN there's a blue link from node i to node j
08: ELSE there's no D2D link from node i and j;
09: node i has a green link with the base station
10: END if
11: END inner for-loop