how to generate random integer matrices on constraints?
조회 수: 1 (최근 30일)
이전 댓글 표시
x=[4 5 5 5 5 5 5 5 5 ];
and,
- sum(x)=44 is alway same.
- 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
댓글 수: 0
답변 (1개)
Roger Stafford
2017년 3월 21일
You can make use of the algorithm given for randfixedsumint shown in:
https://www.mathworks.com/matlabcentral/answers/327656
참고 항목
카테고리
Help Center 및 File Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!