当前位置:网站首页>M matlab simulation of bit error rate using LDPC, turbo and convolutional channel coding and decoding in VBLAST cooperative MIMO system segment

M matlab simulation of bit error rate using LDPC, turbo and convolutional channel coding and decoding in VBLAST cooperative MIMO system segment

2022-07-19 07:08:00 I love c programming

Catalog

1. Algorithm description

2. Partial procedure

3. Preview of some simulation drawings

4. Source code acquisition method  


1. Algorithm description

 

It can be seen from the above structure , The whole structure of convolutional coding can be determined by CRC check , Convolutional coding , Punching composition , The function of punching is to change the code rate after convolutional coding into the required code rate for transmission .

here , We use the following data frame method :

First , The length of data sent each time is :221, Conduct CRC After verification 253, Then the length after convolutional coding is 512, Be careful , Here for 213 Convolutional coding , The data before coding needs to be automatically added 3 individual 0 Make compensation .

 

  in , The parameters we use convolutional coding are 213 System , The coding rate is 1/2, So there is no need to punch holes here .

So the structure of convolutional coding is check , code , decoding , check , It consists of four parts .

Parameter index :

1

R: Bit rate

0.5

2

M,N: Coding sparse check matrix

512,256

3

Number of iterations within the system

40

4

Number of iterations outside the system

4

5

Modulation mode

BPSK

6

Number of transmitting antennas

2

7

Number of receiving antennas

2

2. Partial procedure


for kk = 1:length(EbNo)
    disp(' At present EbNo:');
    EbNo(kk)
    
    totalNumErr = 0;
    count       = 0;
    SNR         = 10^(EbNo(kk)/10);
    N0          = 2*10^(-EbNo(kk)/10);
    sigma       = 1/(sqrt(SNR)/2);   
    ii          = 0;
    Dsd         = 36;          %db Count 
    Dsr         = 36;
    Drd         = 36;
    Qsd         = sqrt(10^(Dsd/10));
    Qsr         = sqrt(10^(Dsr/10));
    Qrd         = sqrt(10^(Drd/10));     
    LL          = 2;
     
    while (totalNumErr < Error_Num)
        totalNumErr
       %%
        RandStream.setDefaultStream(RandStream('mt19937ar','seed',sum(count)));
       %%
        % The sender 
        % The sender 
        % Generate data 
        data       = round(rand(1,N-M)); 
        % Convolution 213 code 
        u          = turbo_encode(data) ;
        u          = [u 0 0];
        % interweave 
        u1         = interlace(u,16,16); 
        %BPSK
        tx         = 2*u1 - 1;    

       %%
        % Coding collaboration agreement 
        % Coding collaboration agreement 
        % The structure block diagram of convolutional coding cooperation in an paper is designed 
        % First of all, for   Sending information is divided into two ways 
        Trans_N1    = tx;        
        Trans_N2    = tx;
        %ii=1 When , Send your own codeword , and ii=2 Send the cooperative codeword when , So as to achieve the effect of time slot 
        ii          = ii + 1;        

        % take N1 Send to destination 
        % take N1 Send to destination 
        % As the sending source 
        % Conduct AF relay 
        % Channel gain 
        Hsd=Qsd*(randn);
        Hsr=Qsr*(randn);
        Hrd=Qrd*(randn);
        % Amplification gain of cooperative nodes 
        B=sqrt(1/(abs(Qsr)^2*1));
        %===============================
        % The weighting factor of the maximum merger ratio is calculated ( The first i The variable gain weighting coefficient of each branch is the ratio of the signal amplitude of the diversity path to the noise power )
        % Calculate the gain 
        A0=conj(Hsd)/(1/(sqrt(LL)*EbNo(kk)));
        A1=B*conj(Hsr)*conj(Hrd)/((B^2*(abs(Hsr))^2+1)*(1/(sqrt(LL)*EbNo(kk))));           
        % receive 
        MIMO_Rx =  Trans_N1/max(abs(Trans_N1))+ 1/(sqrt(SNR))*randn(size(Trans_N1));
        Ysr      = Hsr*MIMO_Rx;
        Yrd      = Hrd*Ysr*B;
        Ysd      = Hsd*MIMO_Rx;
        Y        = A0*Ysd+A1*Yrd; 
        % Received binary signal 
        MIMO_Rx1 = Y;    
        Rec_data1= sign(MIMO_Rx1); 
           
        % take N1 Send to user 2
        % take N1 Send to user 2              
        % receive 
        MIMO_Rx2   = Trans_N1/max(max(Trans_N1))+ 1/(sqrt(SNR))*randn(size(Trans_N1));
        Ysr        = Hsr*MIMO_Rx2;
        Yrd        = Hrd*Ysr*B;
        Ysd        = Hsd*MIMO_Rx2;
        Y          = A0*Ysd+A1*Yrd;       
        % Received binary signal 
        MIMO_Rx12  = Y;   
        Rec_data12 = sign(MIMO_Rx2);                     
 
        % Second time slot , user 2 Send the user to the destination 1 The second frame signal of , The user 2 Recoded about U1 In groups N2 Bit check the modulation signal corresponding to the codeword 
        % stay USER2 in , Will receive N1 The sequence is recoded , Then put the sequence N2 Send to destination 
        % decoding + check :
        [Data_CRC2,LQs]         = turbo_decode(Rec_data12(1:end-2),zeros(N-M+3,1),Frame_Length); 
        % code 
        Ldpc_trans_data_user2  = turbo_encode(Data_CRC2) ;
        Ldpc_trans_data_user2  = [Ldpc_trans_data_user2 0 0];
        Trans_N2_user2         = Ldpc_trans_data_user2;%N2 Sequence 
        Trans_N2_user3         = 2*Trans_N2_user2-1;
           
        %--------------------- Collaboration MIMO----------------------------------
        Hsd=Qsd*(randn);
        Hsr=Qsr*(randn);
        Hrd=Qrd*(randn);
        % Amplification gain of cooperative nodes 
        B=sqrt(1/(abs(Qsr)^2*1));
        %===============================
        % The weighting factor of the maximum merger ratio is calculated ( The first i The variable gain weighting coefficient of each branch is the ratio of the signal amplitude of the diversity path to the noise power )
        % Calculate the gain 
        A0=conj(Hsd)/(1/(sqrt(LL)*EbNo(kk)));
        A1=B*conj(Hsr)*conj(Hrd)/((B^2*(abs(Hsr))^2+1)*(1/(sqrt(LL)*EbNo(kk))));           
        % receive 
        MIMO_Rx =  Trans_N2/max(abs(Trans_N2))+ 1/(sqrt(SNR))*randn(size(Trans_N2));
        Ysr      = Hsr*MIMO_Rx;
        Yrd      = Hrd*Ysr*B;
        Ysd      = Hsd*MIMO_Rx;
        Y        = A0*Ysd+A1*Yrd; 
        % Received binary signal 
        MIMO_Rx2 = Y;
        Rec_data2= sign(MIMO_Rx2);   
        YY1 = [MIMO_Rx12,MIMO_Rx2]';               
        YY2 = [Rec_data12]';        
        Tx  = reshape(YY2 - sqrt(-1)*YY2,Nt, Frame_Length/Nt);    
        RayleighMat = (rand(Nr, Nt) + j*rand(Nr, Nt));   
        rr          = size(RayleighMat*Tx,1);
        cc          = size(RayleighMat*Tx,2);
        r           = RayleighMat*Tx;  
        Hs          = RayleighMat;                                    
        HQ          = Hs*Q;         
 
        
        
       %%
        % Let's start the joint iteration 
        % Let's start the joint iteration 
        rr = r;     
        % Initial radius , Here, the search scope will be expanded , That is, the coefficient alpha As the 12.
        RR =(12*Nt)*(2/(10^(SNR/10)));                                   

        % As shown in the English paper, it turns into a real signal 
        rev1=[real(rr);imag(rr)];  
        H1  = RayleighMat;
        % As shown in the English paper, the channel is transformed into a real matrix 
        HH=[real(H1(:,:)) -imag(H1(:,:));
            imag(H1(:,:))  real(H1(:,:))];              

        LA  = zeros(1,Frame_Length/2);
        LDs = 0;
        LD  = zeros(1,Frame_Length/2);
        LE  = zeros(1,Frame_Length/2);

        for Nout = 1:OUT_Iter
            if Nout == 1
               LA = zeros(1,Frame_Length/2);
            else
               LA = LA2; 
            end
            % spherical map
            for J=1:Frame_Length/2                                            
                rev          = rev1(:,J);                
                % To calculate |r-g*Si|^2
                [y_norm,LDs] = func_FP_MAP(rev,RR,HH,[-1,1],SNR);
                for jj=1:Nt
                    y_2norm(Nt*J+jj-Nt)=y_norm(jj)+j*y_norm(jj+Nt);                  
                end
                % The posterior likelihood ratio information of each bit is 
                LD(J) = LDs;
            end   
            % External iteration mainly calculates  
            LE = LD - LA;
            % De interlacing 
            LE_itrlac_code = de_interlace(LE,16,16); % be used for LDPC Decoding node update 
            DM_msg  = reshape(real(y_2norm),log2(P),Nt*Frame_Length/2);
            for ii2 = 1:length(DM_msg)
                if DM_msg(ii2)~=0
                   DM_msg2(ii2) = abs(DM_msg(ii2)+1)/2;
                else
                   DM_msg2(ii2) = 0; 
                end
            end       
            DM_msg3 = de_interlace(DM_msg,16,16); % be used for LDPC Decoding node update 
            % Internal iterative convolution inside 
            [z_hat,LQ] = turbo_decode(DM_msg3(1:end-2),LE_itrlac_code',Frame_Length);
            x_hat      = z_hat;
            % interweave 
            tmp = LQ(1:length(LE_itrlac_code)) - LE_itrlac_code;
            % interweave 
            LA2 = interlace(tmp,16,16);             
        end
        %===========================================================================
        count       = count + 1;
        totalNumErr = totalNumErr + biterr(round(x_hat), data);
    end
    BERs(kk) = totalNumErr/(count*Frame_Length);
end

3. Preview of some simulation drawings

 

 

4. Source code acquisition method  

Get the way 1:

Click the download link :

m stay VBLAST Collaboration MIMO The system uses LDPC,Turbo, Convolution of three channel codes for bit error rate matlab Simulation + Program operation video

Access method 2:

Blog resource item , Search for resources with the same name as blog .

Access method 3:

If the download link fails , Blogger wechat contact .

01_054_m

原网站

版权声明
本文为[I love c programming]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/200/202207170520334021.html