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

📄 map.m

📁 802.11a phy layer protocol by myself
💻 M
字号:
function d=map(DataInt,Modu)
switch Modu
    case 1         %% BPSK
        for i=1:length(DataInt)
            if DataInt(i)==0
                I(i)=-1;
                Q(i)=0;
            else
                I(i)=1;
                Q(i)=0;
            end
        end
        Kmod=1;
    case 2         %% QPSK
        for i=1:length(DataInt)/2
            switch DataInt(i*2-1)*2+DataInt(i*2)
                case 0 %% b0=0,b1=0
                    I(i)=-1;Q(i)=-1;
                case 1 %% b0=1,b1=0
                    I(i)=1;Q(i)=-1;
                case 2 %% 
                    I(i)=-1;Q(i)=1;
                case 3
                    I(i)=1;Q(i)=1;
            end
        end
        Kmod=1/sqrt(2);
    case 3        %% 16-QAM
        for i=1:length(DataInt)/4
            switch DataInt(4*i-3)*2+DataInt(4*i-2)
                case 0  %% b0b1=00
                    I(i)=-3;
                case 1  %% b0b1=01
                    I(i)=-1;
                case 3  %% b0b1=11
                    I(i)=1;
                case 2  %% b0b1=10
                    I(i)=3;
            end
            switch DataInt(4*i-1)*2+DataInt(4*i)
                case 0  %% b2b3=00
                    Q(i)=-3;
                case 1
                    Q(i)=-1;
                case 3
                    Q(i)=1;
                case 2
                    Q(i)=3;
            end
        end
        Kmod=1/sqrt(10);
    case 4       %% 64-QAM
        for i=1:length(DataInt)/6
            switch DataInt(i*6-5)*4+DataInt(i*6-4)*2+DataInt(i*6-3)
                case 0
                    I(i)=-7;
                case 1
                    I(i)=-5;
                case 3
                    I(i)=-3;
                case 2
                    I(i)=-1;
                case 6
                    I(i)=1;
                case 7
                    I(i)=3;
                case 5
                    I(i)=5;
                case 4
                    I(i)=7;
            end
            switch DataInt(i*6-2)*4+DataInt(i*6-1)*2+DataInt(i*6)
                case 0
                    Q(i)=-7;
                case 1
                    Q(i)=-5;
                case 3
                    Q(i)=-3;
                case 2
                    Q(i)=-1;
                case 6
                    Q(i)=1;
                case 7
                    Q(i)=3;
                case 5
                    Q(i)=5;
                case 4
                    Q(i)=7;
            end
        end
        Kmod=1/sqrt(42);
end
d=(I+Q*j)*Kmod;

⌨️ 快捷键说明

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