qmodulator2.m

来自「OFDM宽带无线系统的链路级的仿真程序(多天线」· M 代码 · 共 35 行

M
35
字号
%Carlos 26/03/06; AAU; DK
%one unnecessary output removed by Yuanye Wang
function  yqam=qmodulator2(x,M)
K=log2(M);                              %x must be even(use the function randint to generate the bits
res=rem(length(x),K);                   %Remainder after division(exact number of bits)
if (res ~= 0)
    x=x(1:length(x)-res);
end
symbi=reshape(x,K,length(x)/K).';        %Reshape in matrix containg column vectors for each symbol in Binary
symdec=bi2de(symbi,'left-msb');          %Converting from binary to Decimal
z=symdec;
%clear yqmod;
switch M
    case 2
        load qam2;
    case 4
        load qam4;
    case 8
        load qam8;
    case 16
        load qam16;
    case 32
        load qam32;
    case 64
        load qam64;
    case 128
        load qam128;
    case 256
        load qam256;
end
for i=1:length(z)
    q(i)=yqmod(z(i)+1);
end
yqam=q;

⌨️ 快捷键说明

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