1 简介
交频分复用(OFDM)作为一种多载波数字通信方案,是第四代移动通信的核心技术.本文介绍了OFDM基本原理,建立了其通信系统模型,并利用Matlab实现了整个系统的动态仿真.仿真结果表明,该系统能很好地反映OFDM的性能特点,同时验证了该仿真方法的正确性和可行性.
2 部分代码
function bit_out = demodu_sym(sym, mod_type)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 功能:  将输入符号映射回比特.大于0,硬判决为比特1;小于0,硬判决为比特0
% 输入:  sym, 输入符号
%       mod_type, 调制类型
% 输出:  bit_out, 输出比特
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bit_out = zeros(mod_type ,size(sym,2));
switch mod_type
    case  1  %  BPSK解调 
        bit_out = real(sym) > 0; 
    case  2  %  QPSK解调
        bit0 = real(sym); 
        bit1 = imag(sym);
        bit_out(1,:) = bit0 > 0;
        bit_out(2,:) = bit1 > 0;
    case  3  %  8PSK解调  
        bit0 = -imag(sym*exp(1j*pi/8));
        bit1 = -real(sym*exp(1j*pi/8));
        bit2 = [];
        for k = 1:length(sym)
            tmp = sym(k)*exp(-1j*pi/8); 
            if ((real(tmp) <0)&&(imag(tmp) > 0))||((real(tmp) > 0)&&(imag(tmp) < 0))
                bit2 = [bit2 0];
            else
                bit2 = [bit2 1];
            end   
        end
        bit_out(1,:) = bit0 >0;
        bit_out(2,:) = bit1 >0;
        bit_out(3,:) = bit2 ;
    case  4  %  16QAM解调   
        bit0 = real(sym);
        bit2 = imag(sym);
        bit1 = 2/sqrt(10)-(abs(real(sym)));
        bit3 = 2/sqrt(10)-(abs(imag(sym)));
        bit_out(1,:) = bit0 > 0;
        bit_out(2,:) = bit1 > 0;
        bit_out(3,:) = bit2 > 0;
        bit_out(4,:) = bit3 > 0;   
    case  6  %  64QAM解调        
        bit0 = real(sym);
        bit3 = imag(sym);
        bit1 = 4/sqrt(42)-abs(real(sym));
        bit4 = 4/sqrt(42)-abs(imag(sym));
        for m=1:size(sym,2)
            for k=1:size(sym,1)
                if abs(4/sqrt(42)-abs(real(sym(k,m)))) <= 2/sqrt(42)  
                    bit2(k,m) = 2/sqrt(42) - abs(4/sqrt(42)-abs(real(sym(k,m))));
                elseif abs(real(sym(k,m))) <= 2/sqrt(42) 
                    bit2(k,m) = -2/sqrt(42) + abs(real(sym(k,m)));
                else
                    bit2(k,m) = 6/sqrt(42)-abs(real(sym(k,m)));
                end;
                if abs(4/sqrt(42)-abs(imag(sym(k,m)))) <= 2/sqrt(42)  
                    bit5(k,m) = 2/sqrt(42) - abs(4/sqrt(42)-abs(imag(sym(k,m))));
                elseif abs(imag(sym(k,m))) <= 2/sqrt(42) 
                    bit5(k,m) = -2/sqrt(42) + abs(imag(sym(k,m)));
                else
                    bit5(k,m) = 6/sqrt(42)-abs(imag(sym(k,m)));
                end;
            end;
        end;
        bit_out(1,:) = bit0 > 0;
        bit_out(2,:) = bit1 > 0;
        bit_out(3,:) = bit2 > 0;
        bit_out(4,:) = bit3 > 0;
        bit_out(5,:) = bit4 > 0;
        bit_out(6,:) = bit5 > 0;
    otherwise
        error('调制方式有误! 子程序demod_sym出错'); 
end3 仿真结果
 
 编辑
编辑
4 参考文献
[1]魏瑞. 基于MATLAB的OFDM通信系统的仿真[J]. 科技广场, 2011(6):3.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
 
 编辑
编辑










