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

📄 qam16demod.m

📁 一个简单的,bpsk,qpsk,QAM16的解调和调制的matlab仿真,特别适用用初学者
💻 M
字号:
function softbit=qam16demod(symbol)
a=sqrt(10);
symlength=length(symbol);
for ii=1:symlength;
    if real(symbol(ii))>=0
        if imag(symbol(ii))>=0
            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
            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
            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
            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 + -