Creating random values with 2 Variable-precision accuracy in Matlab
Mostrar comentarios más antiguos
Hi. I want to create some random values between 0.17 and 0.87 by using the unifrnd command. My question is how can I create values with 2 digits of precision accuracy ? For example I want to have
0.22 0.81 0.27
Thanks a lot.
Respuesta aceptada
Más respuestas (1)
Steven Lord
el 4 de Dic. de 2017
Generate integer values then divide.
intValues = randi([17 87], 1, 1e5);
histogram(intValues, 'BinMethod', 'integers')
decimalValues = intValues/100;
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!