如何随机选择n独特的preambles通过设备的K个一次没有repitition

编程入门 行业动态 更新时间:2024-10-25 06:29:33
本文介绍了如何随机选择n独特的preambles通过设备的K个一次没有repitition的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一些问题需要在MALAB实现。我有N个(的preambles号),以用K来选择(装置的数量)。如何随机选择N的装置的K个,因此能够1 preambles选择由一个以上的设备? 例如,有10个独特的preambles(N = 10),以随机由50台设备(K = 50),只是在一个时间,没有重复的选择和每K个设备只能选择一个来自10个独特的preamble通过随机的。我想知道,从那些10个独特的preambles,有多少被正好一个设备只和其中preambles被选择?多少preambles由一个以上的装置选择并preambles? 如何实现这个场景在MATLAB?我真的需要尽快你的回应。谢谢。

I have some problems to be implemented in malab. I have N (number of preambles) to be chosen by K (number of devices). How to randomly choose N by K number of devices, so it is possible one preambles chosen by more than one devices? for example there are 10 unique preambles (N=10) to be randomly chosen by 50 devices (K=50), just in one time with no repetition and each K devices only can choose one from 10 unique preamble by random. I would like to know from those 10 unique preambles, how many are chosen by exactly one devices only and which preambles? and how many preambles are chosen by more than one devices and which preambles? How to implement this scenario in matlab? I really need your response ASAP. thanks.

推荐答案

试试这个:

r = randperm(N*K); % generate a random permutation of the integers from 1 through N*K r = mod(r(1:N:(K-1)*N+1), N); % the random selection results [uniques,numUnique] = count_unique(r); % the selected preambles (uniques), and how many times they were selected (numUnique)

在 count_unique 函数可以找到这里

更多推荐

如何随机选择n独特的preambles通过设备的K个一次没有repitition

本文发布于:2023-11-28 22:42:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1644236.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:独特   设备   preambles   repitition

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!