generating random values with condition

Hi all
how to generate 12 random values, each number can be in the range from 0.01 to 1 but the summation of each successive 4 numbers must be equal to 1.

댓글 수: 1

Image Analyst
Image Analyst 2020년 1월 15일
This is quirky enough that it sounds very much like homework. And I'm sure that you can't ethically turn in our code as your own, so read this link, and read the documentation on rand(). And realize that you can divide and multiply sets of 4 numbers to get new, scaled numbers.

댓글을 달려면 로그인하십시오.

답변 (1개)

James Tursa
James Tursa 2020년 1월 15일

0 개 추천

You could use this FEX submission by Roger Stafford for each 4 number block:

카테고리

도움말 센터File Exchange에서 Random Number Generation에 대해 자세히 알아보기

질문:

2020년 1월 15일

답변:

2020년 1월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by