is this matlab code of 8psk ??
조회 수: 2 (최근 30일)
이전 댓글 표시
l=100000; %L length of si the input one dimension array
nni=randn(1,l);%generate L by L array of random scalare
si=randsrc(1,l,[+1,-1;.5,.5]);%generate 1 by L array of -1&+1
snr=[0:15];
for i=1:16
errorcounter=0;
stdn=sqrt(10^(-snr(i)/10))
ni=nni*stdn;% ni is 1 by L dimension
for m=1:l
ri(m)=ni(m)+si(m);
if ri(m)>0
sdi(m)=1;
elseif ri(m)<=0
sdi(m)=-1;
end
if sdi(m)~=si(m)
errorcounter=errorcounter+1;
end
end
ber(i)=errorcounter/l
end
semilogy(snr,ber,'r','LineWidth',2)
xlabel('snr db');ylabel('ber');grid;
댓글 수: 5
Rick Rosson
2013년 3월 2일
- Please use proper indentation in your code.
- Please do not use lower-case l as a variable. It looks almost the same as the numeral 1 and is very confusing. Use upper-case L instead.
- Please add comments explaining what each variable represents.
Thanks.
채택된 답변
Rick Rosson
2013년 3월 2일
편집: Rick Rosson
2013년 3월 2일
No. As far as I can tell, this code is BPSK, not 8PSK. Also, there are several mistakes in the code.
댓글 수: 4
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 PSK에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!