Permutation and combination
Show older comments
Hi all, I am trying to solve a problem. I need a matlab code which automatically calculates the possible number of combinations of dividing a number or constant to eg 3 objects using a defined step.
eg to divide 60 to A, B, C using step size 60. Possibilities will be [60 0 0; 0 60 0; 0 0 60] --> 3 possible combinations
120 using step 60, will be [120 0 0; 0 120 0; 0 0 120; 60 60 0; 60 0 60; 0 60 60] --> 6 possible combinations ... and so on
Can anyone help me with a matlab code which computes these possible number of combinations? I will be very grateful. Hummy
Answers (1)
Jan
on 21 Oct 2011
0 votes
This FEX submission solves the main part of your porblem:
Categories
Find more on Elementary Math in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!