채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 22일

0 개 추천

The "compare to" block converts the random numbers smaller than 0.5 to 1 and larger than 0.5 to 0. I recommend using the "uniform random number block": https://www.mathworks.com/help/releases/R2020a/simulink/slref/uniformrandomnumber.html instead of random number block used in that answer. The uniform random number block only generates a number between 0 and 1. If you set the constant to 0, then you will get all 0s. If you set it to 1 then you will get all 1s. If you set it to some in-between value, then say 0.3, then you will get 30% 1s and 70% 0s.

댓글 수: 2

Huy Pham Quoc
Huy Pham Quoc 2020년 4월 23일
thank you!
Ameer Hamza
Ameer Hamza 2020년 4월 23일
Glad to be of help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

제품

릴리스

R2019b

태그

질문:

2020년 4월 22일

댓글:

2020년 4월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by