mrc1x2.m
来自「2x1 MRRC using BPSK」· M 代码 · 共 34 行
M
34 行
SNRdb=[0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30]; %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.
Ber1(i)=0;
for run=1:10000 %The choose of 'run' value is
%important at this point since it will help us to achieve realistic results
s0=(sign(randn(1,100))+j*sign(randn(1,100)))./sqrt(2); %Transmitted signal is constructed
H0=((randn(1,100))+j*(randn(1,100)));
H1=((randn(1,100))+j*(randn(1,100)));
N0=(sigma*((randn(1,100))+j*(randn(1,100))))./sqrt(2);
N1=(sigma*((randn(1,100))+j*(randn(1,100))))./sqrt(2);
r0=H0.*s0+N0;
r1=H1.*s0+N1;
%ML
Shat=conj(H0).*r0+conj(H1).*r1;
S0hat=sign(real(Shat));
S1hat=sign(imag(Shat));
STas=(S0hat+j*S1hat)./sqrt(2);
Error=(sum(s0~=STas));
Ber1((i))=Ber1(i)+Error./(2*100);
end
end
Ber1=Ber1/run
semilogy(SNRdb,Ber1,'-*');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 + =
减小字号Ctrl + -
显示快捷键?