Borrar filtros
Borrar filtros

how to random value?

1 visualización (últimos 30 días)
Tia
Tia el 3 de Abr. de 2013
how to random value 2 until 3? example:
>> a=rand(1)
a =
0.8833
but i want the answer 2,3 or 2,5 or 2,6, or 3. thanks

Respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 3 de Abr. de 2013
Editada: Azzi Abdelmalek el 3 de Abr. de 2013
n=3
a=rand*n %
  2 comentarios
Tia
Tia el 3 de Abr. de 2013
it doesn't work. the answer still 1 commas until 3. i want the answer's between 2 to 3
Azzi Abdelmalek
Azzi Abdelmalek el 3 de Abr. de 2013
Then use
a=rand+2

Iniciar sesión para comentar.


Mahdi
Mahdi el 3 de Abr. de 2013
Editada: Mahdi el 3 de Abr. de 2013
Generate values from the uniform distribution on the interval [a, b].
r = 2 + (3-2).*rand(1);
or the general form
r=a+(b-a).*rand(n);

Categorías

Más información sobre Calendar en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by