⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stbcbpsk2x1.m

📁 Alamouti code 2x1 using BPSK
💻 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);
s1=(sign(randn(1,k)))./sqrt(2);

  H0=((randn(1,k))+j*(randn(1,k)))./sqrt(2);
    H1=((randn(1,k))+j*(randn(1,k)))./sqrt(2);
    N0=(sigma*((randn(1,k))+j*(randn(1,k))))./sqrt(2);
    N1=(sigma*((randn(1,k))+j*(randn(1,k))))./sqrt(2);
    r0=H0.*s0+H1.*s1+N0;
    r1=-H0.*conj(s1)+H1.*conj(s0)+N1;
    %ML
    Shat1=conj(H0).*r0+H1.*conj(r1);
    Shat2=conj(H1).*r0-H0.*conj(r1);

    S0hat=sign(real(Shat1))./sqrt(2);
  
    
    S00hat=sign(real(Shat2))./sqrt(2);
  

    
    
    
    Error1=(sum(s0~=S0hat));
    Error2=(sum(s1~=S00hat));
    Ber2(i)=Ber2(i)+(Error1+Error2)./(2*k);
    
     
    
    
    
    end
end
Ber2=Ber2/run;
hold on
 semilogy(SNRdb,Ber2,'gv-','LineWidth',2);
xlabel('E_b/N_0 (dB)');ylabel('BER (P_e)');grid;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -