Enumerate outcomes of Sampling without order, but with replacement
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.
Cite As
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. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Mathematics > Elementary Math >
- MATLAB > Language Fundamentals > Matrices and Arrays > Resizing and Reshaping Matrices >
- MATLAB > Mathematics > Elementary Math > Discrete Math >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |