how do I generate a binary sequence with certain probabilities?
for instance, I want 0 to have 0.6 and 1 to have 0.4 probability
It would be very helpful if you give me the whole code to this

 Respuesta aceptada

John D'Errico
John D'Errico el 28 de Mzo. de 2020

0 votos

rand() < 0.6
If you want a random binary sequence of length n, then this is sufficient:
rand(1,n) < 0.6

Más respuestas (0)

Categorías

Más información sobre Random Number Generation en Centro de ayuda y File Exchange.

Preguntada:

el 28 de Mzo. de 2020

Respondida:

el 28 de Mzo. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by