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

📄 16qam解调.m

📁 ofdm中几种常用的调制方式的调制和解调程序
💻 M
字号:
function softbit=QAM16Demod(symbol)
% 16QAM解调
% 16QAM:   s3  s2  s1  s0      m1       mQ
%          0   0   0   0       3A       3A
%          0   0   0   1        A       3A
%          0   0   1   1       -A       3A 
%          0   0   1   0      -3A       3A
%          0   1   0   0       3A       A   
%          0   1   0   1       A        A   
%          0   1   1   1      -A        A
%          0   1   1   0      -3A       A
%          1   1   0   0      3A       -A
%          1   1   0   1       A       -A
%          1   1   1   1      -A       -A
%          1   1   1   0      -3A      -A
%          1   0   0   0       3A     -3A
%          1   0   0   1       A      -3A
%          1   0   1   1      -A      -3A
%          1   0   1   0      -3A     -3A
%
%  note:A=1/sqrt(10)
%
symlength=length(symbol);
A=1/sqrt(10);
% temp(ii*4)=s3,temp(ii*4-1)=s2,temp(ii*4-2)=s1,temp(ii*4-3)=s0
for ii=1:symlength
    if real(symbol(ii))>=0
        if imag(symbol(ii))>=0 %#Quadrant
            if real(symbol(ii))>=2*A
                if imag(symbol(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(symbol(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(symbol(ii))>=2*A
                if imag(symbol(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(symbol(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(symbol(ii))>=0   %2#Quadrant
            if real(symbol(ii))>=-2*A
                if imag(symbol(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(symbol(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(symbol(ii))>=-2*A
                if imag(symbol(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(symbol(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
softbit=temp;
                  
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                    

⌨️ 快捷键说明

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