📄 mrcbpsk1x4.m
字号:
clear all
SNRdb=[0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30];
k=100;
%The graph will be drawn using different SNR values.
for i=1:length(SNRdb) %The Program will continue computing for these different values.
sigma=sqrt(10^(-SNRdb(i)/10)); %N0 variance of the noise will be computed.
Ber2(i)=0;
for run=1:10000
%The choose of 'run' value is
s0=(sign(randn(1,k)))./sqrt(2);
H0=((randn(1,k))+j*(randn(1,k)));
H1=((randn(1,k))+j*(randn(1,k)));
H2=((randn(1,k))+j*(randn(1,k)));
H3=((randn(1,k))+j*(randn(1,k)));
N0=(sigma*((randn(1,k))+j*(randn(1,k))))./sqrt(2);
N1=(sigma*((randn(1,k))+j*(randn(1,k))))./sqrt(2);
N2=(sigma*((randn(1,k))+j*(randn(1,k))))./sqrt(2);
N3=(sigma*((randn(1,k))+j*(randn(1,k))))./sqrt(2);
r0=H0.*s0+N0;
r1=H1.*s0+N1;
r2=H2.*s0+N2;
r3=H3.*s0+N3;
%ML
Shat=conj(H0).*r0+conj(H1).*r1+conj(H2).*r2+conj(H3).*r3;
S0hat=(sign(real(Shat)))./sqrt(2);
Error=(sum(s0~=S0hat));
Ber2(i)=Ber2(i)+Error./(k);
end
end
Ber2=Ber2/run
semilogy(SNRdb,Ber2,'-*');title('BER Characteristic of QPSK Modulated Signals for Different SNR');
xlabel('E_b/N_0 (dB)');ylabel('BER (P_e)');grid;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -