• 大小: 6KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-10
  • 语言: Matlab
  • 标签: 分集  qpsk  awgn信道  

资源简介

非常详细,有条理的代码,可以画图,已经编译通过

资源截图

代码片段和文件信息

clear;
clc;
Rep=10;             %初始化
Num=500000;
snr=0:3:30;
error0=0;
error1=0;
error2=0;
error4=0;
error8=0;
p0=zeros(1length(snr));
p1=zeros(1length(snr));
p2=zeros(1length(snr));
p3=zeros(1length(snr));
p4=zeros(1length(snr));
 
for i=1:length(snr)
    error0=0;
    error1=0;
    error2=0;
    error4=0;
    error8=0;
    
    sigma0=10^(-snr(i)/20);
    sigma1=10^(-snr(i)/20);
    sigma2=sqrt(2)*10^(-snr(i)/20);
    sigma4=2*10^(-snr(i)/20);
    sigma8=2*sqrt(2)*10^(-snr(i)/20);
    for j=1:Rep
        x_re=randsrc(1Num);          %输入信号
        x_im=randsrc(1Num);
        x=x_re+1i*x_im;
        
        Rly_re=randn(1Num);        %瑞利信道
        Rly_im=randn(1Num);
        Rly=Rly_re+1i*Rly_im;
        R0=sqrt(Rly.*conj(Rly));
        
        Rly_re1=randn(1Num);
        Rly_im1=randn(1Num);
        Rly1=Rly_re1+1i*Rly_im1;
        R1=sqrt(Rly1.*conj(Rly1));
        
        Rly_re2=randn(1Num);
        Rly_im2=randn(1Num);
        Rly2=Rly_re2+1i*Rly_im2;
        R2=sqrt(Rly2.*conj(Rly2));
        
        Rly_re3=randn(1Num);
        Rly_im3=randn(1Num);
        Rly3=Rly_re3+1i*Rly_im3;
        R3=sqrt(Rly3.*conj(Rly3));
        
        Rly_re4=randn(1Num);
        Rly_im4=randn(1Num);
        Rly4=Rly_re4+1i*Rly_im4;
        R4=sqrt(Rly4.*conj(Rly4));
       
        Rly_re5=randn(1Num);
        Rly_im5=randn(1Num);
        Rly5=Rly_re5+1i*Rly_im5;
        R5=sqrt(Rly5.*conj(Rly5));
        
        Rly_re6=randn(1Num);
        Rly_im6=randn(1Num);
        Rly6=Rly_re6+1i*Rly_im6;
        R6=sqrt(Rly6.*conj(Rly6));
        
        Rly_re7=randn(1Num);
        Rly_im7=randn(1Num);
        Rly7=Rly_re7+1i*Rly_im7;
        R7=sqrt(Rly7.*conj(Rly7));        
        
%AWGN信道噪声无分集噪声 
        Noise_re=sigma0*randn(1Num);          
        Noise_im=sigma0*randn(1Num);
        Noise0=Noise_re+1i*Noise_im;
%二分集噪声        
        Nois_re1=sigma2*randn(1Num);
        Nois_im1=sigma2*randn(1Num);
        Nois1=Nois_re1+1i*Nois_im1;

        Nois_re2=sigma2*randn(1Num);     
        Nois_im2=sigma2*randn(1Num);
        Nois2=Nois_re2+1i*Nois_im2;
 %四分集噪声
        Noi_re1=sigma4*randn(1Num);
        Noi_im1=sigma4*randn(1Num);
        Noi1=Noi_re1+1i*Noi_im1;

        Noi_re2=sigma4*randn(1Num);     
        Noi_im2=sigma4*randn(1Num);
        Noi2=Noi_re2+1i*Noi_im2;

        Noi_re3=sigma4*randn(1Num);    
        Noi_im3=sigma4*randn(1Num);
        Noi3=Noi_re3+1i*Noi_im3;
        
        Noi_re4=sigma4*randn(1Num);    
        Noi_im4=sigma4*randn(1Num);
        Noi4=Noi_re4+1i*Noi_im4;
%八分集噪声
        No_re=sigma8*randn(1Num);          
        No_im=sigma8*randn(1Num);
        No0=No_re+1i*No_im;

        No_re1=sigma8*randn(1Num);
        No_im1=sigma8*randn(1Num);
        No1=Noi_re1+1i*Noi_im1;

        No_re2=sigma8*ran

评论

共有 条评论