matlab中产生随机点,如何在matlab中创建圆并在其中生成随机点

您好我想问一个问题如何在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

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值