I want to generate a matrix of random numbers between 0 and 2.5 with length=8 and the sum of generated numbers be 20
조회 수: 4 (최근 30일)
이전 댓글 표시
I want to generate a matrix of random numbers between 0 and 2.5
The length of generated matrix should be 8 and the total sum of generated matrix should be 20.
need help
thanks in advance
댓글 수: 0
채택된 답변
the cyclist
2021년 10월 22일
편집: the cyclist
2021년 10월 22일
댓글 수: 2
the cyclist
2021년 10월 22일
I read your question a bit more closely.
Of course, there is only one way to have 8 numbers that sum to 20, if the max is 2.5, which is to have all the numbers equal 2.5.
So, this function has returned the correct and only answer.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!