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

📄 channel_decoding.m

📁 本程序是MIMO-OFDM 系统的信道估计程序
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 根据不同用户的信道编码参数,进行信道解码


function decoded_user_bit = channel_decoding ( demod_user_bit ,ChCodingMethod,Dec_alg,L_total,Generator,Puncture,...
    N_iter,RateChCoding,Alpha,Turbo_frame,N_Turbo_frame, UserRS_Coding , UserTrellis,TraceBackLen, user_bit_cnt,...
    turn_on )

if turn_on
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 使用Turbo码 + 交织 
    if ChCodingMethod == 1
        % 先假设单用户情况
        

        
        soft_bits = demod_user_bit.';
        
        turbo_decoded = zeros(1,Turbo_frame*N_Turbo_frame);
        
        for n = 1:N_Turbo_frame
            
            soft_bits_frame = soft_bits(1,(n-1)*L_total/RateChCoding + 1:n*L_total/RateChCoding );
            
            yk = demultiplex(soft_bits_frame,Alpha,Puncture);
            
            % Scale the received bits      
            % rec_s = 0.5*L_c*yk;
            rec_s = yk;
            
            % Initialize extrinsic information      
            L_e(1:L_total) = zeros(1,L_total);
            
            for iter = 1:N_iter
                % Decoder one
                L_a(Alpha) = L_e;  % a priori info. 
                if Dec_alg == 0
                    
                    L_all = logmapo(rec_s(1,:), Generator, L_a, 1);  % complete info.
                else   
                    L_all = sova0(rec_s(1,:), Generator, L_a, 1);  % complete info.
                end   
                L_e = L_all - 2*rec_s(1,1:2:2*L_total) - L_a;  % extrinsic info.
                
                % Decoder two         
                L_a = L_e(Alpha);  % a priori info.
                if Dec_alg == 0
                    L_all = logmapo(rec_s(2,:), Generator, L_a, 2);  % complete info.  
                else
                    L_all = sova0(rec_s(2,:), Generator, L_a, 2);  % complete info. 
                end
                L_e = L_all - 2*rec_s(2,1:2:2*L_total) - L_a;  % extrinsic info.
                
            end	%iter
            
            % Estimate the info. bits        
            xhat(Alpha) = (sign(L_all)+1)/2;    % 硬判决
            turbo_decoded(1,(n-1)*Turbo_frame + 1:n*Turbo_frame ) = xhat(1:Turbo_frame);
            
        end
        
        decoded_user_bit =  turbo_decoded';
        %err_bits = length(find(bits ~= turbo_decoded)) ; 
        
        
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        % 使用卷积 + RS + 交织    
    elseif ChCodingMethod == 2
        
        user_convdecode = vitdec(demod_user_bit,UserTrellis,TraceBackLen ,'cont','hard');        
        user_convdecode = user_convdecode(TraceBackLen + 1:end);
        user_rsdecode = rsdeco(user_convdecode,UserRS_Coding(1),UserRS_Coding(2));
        decoded_user_bit = user_rsdecode(1:user_bit_cnt);
        
    end
    
else
    decoded_user_bit = demod_user_bit > 0;
    
end

⌨️ 快捷键说明

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