si=2*(round(rand(1,sbit))-1/2);
조회 수: 5 (최근 30일)
이전 댓글 표시
i am trying to generate a random signal with only +1 & -1 the code works the only problem that i donot under stand way we put the 2 and -1/2
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2013년 11월 5일
a=rand%
b=rand(a) % the result is 0 or 1
%If b=1
2*(1-1/2)=1
%If b=0
2*(0-1/2)=-1
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!