How to impose a condition creating a matrix.
Ältere Kommentare anzeigen
I want to create a matrix with all the possible combinations of 10 numbers between 0 and 100, with intervals of 5, that its sum be equal to 100. I mean something like this:
(0 0 0 0 0 0 0 0 0 10 90; 10 10 10 10 10 10 10 10 20 0;...)
I use "allcomb.m" to create something like all the possible numbers that are between 0 and 100, with intervals of 5. However, this matrix is so big, and that implies that Matlab doesn't create it. I was thinking that, if I have that matrix, I could reduce it using a condition but this is impossible because I never get the matrix. So, the question is how I can modify the allcomb's code with the condition in the same code or maybe, and better, another way to create the matrix that I purpose.
Thanks.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!