2BPSK调制下瑞利信道三种分集合并技术的误码率分析

等增益合并

clear;
N=10^6;
data=randi([0,1],1,N);
x=2*data-1; 
s=zeros(1,N);
ber_EGC=zeros(1,N);
 
    for snr_dB=1:1:20
            error=0;
            h1=((randn(1,N)+(randn(1,N)*1i)))/sqrt(2);
            h2=((randn(1,N)+(randn(1,N)*1i)))/sqrt(2);
            c1=h1.*x;
            c2=h2.*x;
            y1=awgn(c1,snr_dB,'measured');
            y2=awgn(c2,snr_dB,'measured');
            y_rec = y1.*exp(-1i*angle(h1)) + y2 .*exp(-1i*angle(h2)); 
            
             H=abs(h1)+abs(h2);
             yHat = y_rec./H;  
             ipHat = real(yHat)>0;
             ber_EGC(snr_dB) = size(find([data- ipHat]),2);
             ber_EGC(snr_dB)=ber_EGC(snr_dB)/N;
    end         
figure;
semilogy(ber_EGC,'go-');
legend('EGC');
xlabel('SNR');
ylabel('BER');
title('BER for 1tx vs 2rx');

最大比合并

N=10^6;
data=randi([0,1],1,N);
x=2*data-1;
 
s=zeros(1,N);
ber_MRC=zeros(1,N);
for snr_dB=1:1:20
            error=0;
            h1=(randn(1,N)+(randn(1,N)*1i))/sqrt(2);
            h2=(randn(1,N)+(randn(1,N)*1i))/sqrt(2);
            c1=h1.*x;
            c2=h2.*x;
            y1=awgn(c1,snr_dB,'measured');
            y2=awgn(c2,snr_dB,'measured');
            y_rec =conj(h1).*y1+conj(h2).*y2;
            
            H=(abs(h1)).^2+(abs(h2)).^2;   
            yHat = y_rec./H;  
            ipHat = real(yHat)>0;
            ber_MRC(snr_dB) = size(find([data- ipHat]),2);
            ber_MRC(snr_dB)=ber_MRC(snr_dB)/N;
end                
figure;
semilogy(ber_MRC,'k*-');
legend('MRC');
xlabel('SNR');
ylabel('BER');
title('BER for 1tx vs 2rx'); 
    
    
        
        
    
    

选择合并

N=10^6;
data=randi([0,1],1,N);
x=2*data-1;
s=zeros(1,N);
ber_SC=zeros(1,N);
for snr_dB=1:20
            h1=(randn(1,N)+(randn(1,N)*1i))/sqrt(2);
            h2=(randn(1,N)+(randn(1,N)*1i))/sqrt(2);
            c1=h1.*x;
            c2=h2.*x;
            y1=awgn(c1,snr_dB,'measured');
            y2=awgn(c2,snr_dB,'measured');
         
           hPower1 = sum(h1.*conj(h1));
           hPower2 = sum(h2.*conj(h2));
           if(hPower1>hPower2) 
               y_rec=y1;
               H=h1;
           else
               y_rec=y2;
               H=h2;
           end
             error=0;     
            yHat = y_rec./H;  
            ipHat = real(yHat)>0;
            ber_SC(snr_dB) = size(find([data- ipHat]),2);
            ber_SC(snr_dB)=ber_SC(snr_dB)/N;
end

figure;
semilogy(ber_SC,'m*-');hold on;
legend('SC');
xlabel('SNR');
ylabel('BER');
title('BER for 1tx vs 2rx');
        
               

   






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

w360366

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值