Why do i need to divided by log2(M) * Ts instead of Ts ? For the symbol error rate of 8-PSK
조회 수: 4 (최근 30일)
이전 댓글 표시
I saw this code of 8-PSK in the internet,and i don't know why do i need to divided by log2(M) * Ts instead of Ts
code:
M=8;
r=sqrt(3);
Ts=10^4;
SNR_dB=[-3,0,3,6,9];
Ne=zeros(1,length(SNR_dB));
y=zeros(1,5);
theta=zeros(1,M);
Eav=r^2;
Eavb=Eav/log2(M);
for ii=1:length(SNR_dB)
SNR=10^(SNR_dB(ii)/10);
No=Eavb/SNR;
for jj=1:M
theta(jj)=((jj-1)*2*pi/M);
end
for t=1:Ts
s=randi(M)-1;
s_bin=dec2bin(s,3)-'0';
s_new=r*cos(theta(s+1))+1i*r*sin(theta(s+1));
n=randn(1,2)*sqrt(No/2);
r0=real(s_new)+n(1);%
r1=imag(s_new)+n(2);
theta_r=angle(r0+r1*1i);
if -1*pi<theta_r && theta_r <0
theta_r=theta_r+2*pi;
end
if (theta(1)-(pi/M)+(2*pi))<theta_r ||theta_r <(theta(1)+(pi/M))
s_hat=0;
s_hat_bin=dec2bin(s_hat,3)-'0';
end
detect
for k=2:M
if (theta(k)-(pi/M))<theta_r && theta_r<(theta(k)+(pi/M))
s_hat=k-1;
s_hat_bin=dec2bin(s_hat,3)-'0';
end
end
for n=1:log2(M)
if s_bin(n)~=s_hat_bin(n)
Ne(1,ii)=Ne(1,ii)+1;
end
end
y(1,ii)=Ne(1,ii)./(log2(M)*Ts)%why do i need to divided by log2(M) * Ts instead of Ts
end
end
semilogy(SNR_dB,y,'-r');
grid on
Because the error probability is : total error numuber/total number,in this code,i create Ts number,and turn them into the the 3bits binary code,i mean 0=>000,7=>111.So in fact,i create Ts numbers instead of log2(M)*Ts.
And i modify these code
for n=1:log2(M)
if s_bin(n)~=s_hat_bin(n)
Ne(1,ii)=Ne(1,ii)+1;
end
end
y(1,ii)=Ne(1,ii)./(log2(M)*Ts)
to
if s_bin~=s_hat_bin
Ne(1,ii)=Ne(1,ii)+1
end
y(1,ii)=Ne(1,ii)./Ts
The simulation become wrong ,why?
The second code i can explain that i compare the nth bit of s_bin with nth bit of s_hat_bin,if their bit are not equal,then the error number will plus one.
The third code i can explain that i compare the s_bin with nth bit of s_hat_bin,i mean like s_bin=000,s_hat_bin = 001,then s_bin is not equal to s_hat_bin so plus 1.
Or is the second code for bit error rate and the third code for the symbol error rate?
Can anyone tell me?
댓글 수: 0
답변 (1개)
KALYAN ACHARJYA
2019년 4월 29일
편집: KALYAN ACHARJYA
2019년 4월 29일
Why do i need to divided by log2(M) * Ts instead of Ts ?
Please check the below expression and discuss with your communication teacher.
Detail here
참고 항목
카테고리
Help Center 및 File Exchange에서 Test and Measurement에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!