MATLAB Answers

generating random values with condition

2 views (last 30 days)
nada ahmed
nada ahmed on 15 Jan 2020
Answered: James Tursa on 15 Jan 2020
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 Comment

Image Analyst
Image Analyst on 15 Jan 2020
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.

Sign in to comment.

Answers (1)

James Tursa
James Tursa on 15 Jan 2020
You could use this FEX submission by Roger Stafford for each 4 number block:

  0 Comments

Sign in to comment.

Sign in to answer this question.