generating random values with condition

2 visualizaciones (últimos 30 días)
nada ahmed
nada ahmed el 15 de En. de 2020
Respondida: James Tursa el 15 de En. de 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 comentario
Image Analyst
Image Analyst el 15 de En. de 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.

Iniciar sesión para comentar.

Respuestas (1)

James Tursa
James Tursa el 15 de En. de 2020
You could use this FEX submission by Roger Stafford for each 4 number block:

Community Treasure Hunt

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

Start Hunting!

Translated by