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

📄 demapping16qam.m

📁 这是一个基于16QAM调制的OFDM系统仿真。
💻 M
字号:
function Code=demapping16QAM(bit)
bitlength=length(bit);
A=1/sqrt(10);
for ii=1:bitlength
    if real(bit(ii))>=0
        if imag(bit(ii))>=0%------------1#Quadrand
            if real(bit(ii))>=2*A
                if imag(bit(ii))>=2*A
                    temp(ii*4)=0;
                    temp(ii*4-1)=0;
                    temp(ii*4-2)=0;
                    temp(ii*4-3)=0;
                else
                    temp(ii*4)=0;
                    temp(ii*4-1)=1;
                    temp(ii*4-2)=0;
                    temp(ii*4-3)=0;
                end
            else
                if imag(bit(ii))>=2*A
                    temp(ii*4)=0;
                    temp(ii*4-1)=0;
                    temp(ii*4-2)=0;
                    temp(ii*4-3)=1;
                else
                    temp(ii*4)=0;
                    temp(ii*4-1)=1;
                    temp(ii*4-2)=0;
                    temp(ii*4-3)=1;
                end
            end
        else        %----------4#Quadrant
             if real(bit(ii))>=2*A
                  if imag(bit(ii))>=-2*A
                    temp(ii*4)=1;
                    temp(ii*4-1)=1;
                    temp(ii*4-2)=0;
                    temp(ii*4-3)=0;
                  else
                      temp(ii*4)=1;
                    temp(ii*4-1)=0;
                    temp(ii*4-2)=0;
                    temp(ii*4-3)=0;
                  end
             else
                 if imag(bit(ii))>=-2*A
                     temp(ii*4)=1;
                    temp(ii*4-1)=1;
                    temp(ii*4-2)=0;
                    temp(ii*4-3)=1;
                 else
                     temp(ii*4)=1;
                    temp(ii*4-1)=0;
                    temp(ii*4-2)=0;
                    temp(ii*4-3)=1;
                 end
             end
        end
    else
       if imag(bit(ii))>=0   %-----------2#Quadrant
           if real(bit(ii))>=-2*A
               if imag(bit(ii))>=2*A
                   temp(ii*4)=0;
                    temp(ii*4-1)=0;
                    temp(ii*4-2)=1;
                    temp(ii*4-3)=1;
               else
                   temp(ii*4)=0;
                    temp(ii*4-1)=1;
                    temp(ii*4-2)=1;
                    temp(ii*4-3)=1;
               end
           else
               if imag(bit(ii))>=2*A
                   temp(ii*4)=0;
                    temp(ii*4-1)=0;
                    temp(ii*4-2)=1;
                    temp(ii*4-3)=0;
               else
                   temp(ii*4)=0;
                    temp(ii*4-1)=1;
                    temp(ii*4-2)=1;
                    temp(ii*4-3)=0;
               end
           end 
       else   %-----------3#Quadrant
           if real(bit(ii))>=-2*A
               if imag(bit(ii))>=-2*A
                   temp(ii*4)=1;
                    temp(ii*4-1)=1;
                    temp(ii*4-2)=1;
                    temp(ii*4-3)=1;
               else
                   temp(ii*4)=1;
                    temp(ii*4-1)=0;
                    temp(ii*4-2)=1;
                    temp(ii*4-3)=1;
               end
           else
               if imag(bit(ii))>=-2*A
                   temp(ii*4)=1;
                    temp(ii*4-1)=1;
                    temp(ii*4-2)=1;
                    temp(ii*4-3)=0;
               else
                   temp(ii*4)=1;
                    temp(ii*4-1)=0;
                    temp(ii*4-2)=1;
                    temp(ii*4-3)=0;
               end
           end
       end
    end
end
Code=temp;

⌨️ 快捷键说明

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