generating random values with condition

조회 수: 2 (최근 30일)
nada ahmed
nada ahmed 2020년 1월 15일
답변: James Tursa 2020년 1월 15일
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일
You could use this FEX submission by Roger Stafford for each 4 number block:

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by