Enumerate outcomes of Sampling without order, but with replacement

版本 1.0.0.0 (1.6 KB) 作者: Jonathan Epperl
Draw k times from {1,2,..,n}, but return each drawn element -- which unique combinations are there?
208.0 次下载
更新时间 2012/2/29

查看许可证

Given a set
S = {1,2,...,n},
nreplace(n,k) returns a matrix, each row of which represents a possible outcome of selecting k elements from S, while one element can be selected multiple times. See e.g. the Example at the bottom of http://en.wikibooks.org/wiki/Probability/Combinatorics#Partitions.
The implementation is recursive, using a nested function, so it will only run on Matlab Version 7 and upwards.

引用格式

Jonathan Epperl (2024). Enumerate outcomes of Sampling without order, but with replacement (https://www.mathworks.com/matlabcentral/fileexchange/35378-enumerate-outcomes-of-sampling-without-order-but-with-replacement), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2010b
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0