how do I generate a random signal with each point being -1 or +1 in MATLAB
조회 수: 1 (최근 30일)
이전 댓글 표시
채택된 답변
Rik
2022년 10월 21일
randi([0 1],1,N)*2-1
That should do it. Or even this:
sign(rand(1,N)-0.5)
Although it is possible that generates a 0 if rand happens to land exactly on 0.5.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Waveform Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!