Filter löschen
Filter löschen

how to generate random integer matrices on constraints?

1 Ansicht (letzte 30 Tage)
Brian Kim
Brian Kim am 21 Mär. 2017
Bearbeitet: Stephen23 am 21 Mär. 2017
x=[4 5 5 5 5 5 5 5 5 ];
and,
  1. sum(x)=44 is alway same.
  2. As a result,
x{1}=[4 4 4 5 5 5 5 6 6]
x{2}=[4 4 5 5 5 5 5 5 6]
x{3}=[4 4 5 5 6 6 6 8]
x{4}=[4 4 5 5 5 5 7 9]
x{5}=[5 5 5 6 6 7 10]
.
.
.
.
.
.
etc.
i want to generate this form example.
please help me

Antworten (1)

Roger Stafford
Roger Stafford am 21 Mär. 2017
You can make use of the algorithm given for randfixedsumint shown in:
https://www.mathworks.com/matlabcentral/answers/327656
  1 Kommentar
Brian Kim
Brian Kim am 21 Mär. 2017
by the way, i took the constraints. registrable numbers must be [4 5 6 7 8 9 10 11 12]. if apply this, how can i do?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Elementary Math finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by