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

📄 modulation.m

📁 这是一个用MATLAB编程的64QAM程序
💻 M
字号:
function mod_out=modulation(mod_in,mod_mode)

%%根据输入的调制方式,对输入序列MOD_IN进行调制,采用64QAM,
%%完成对星座图的映射,输出为Y.转化的方法为:先写出十进制情况下从0 到N-1
%%(N为星座图的点数)所对应的星座坐标;再将输入的二进制序列转化为相应的
%%十进制,以查表的方法查出对应点的复数坐标,即为调制映射后的结果。



%% Input: 
%%-------------------------------------------------------------------------
%%  mod_in:输入的二进制序列(The sequence to be modulated)
%%-------------------------------------------------------------------------
%% Output:
%%-------------------------------------------------------------------------
%% mod_out:星座图映射后得到的调制复数结果(The output after modulation)
%%-------------------------------------------------------------------------
%% Global Variable:
%%  g_RT (the vector which contains the modulation mode)
%%-------------------------------------------------------------------------
%% Z :选择调制方式的参数 (the parameter to choose the modulation mode)
%%
%% R :输入二进制序列重新排列(按一定要求)后的结果,例如:对64QAM,要把输入序列调整为
%% 4行,length(g_MOD_IN_16QAM )/4  列的矩阵。(Reshape the input binary sequence to be
%% matrix of n-row,m-column .For example,16QAM,will be reshaped into 4-row,
%%length(g_MOD_IN_16QAM))/4 column )
%%
%% B2D :二进制向十进制转化后的结果 (convert the binary sequence to  dec )
%%
%% Temp:星座图阵列 (the  constellation)
%%-------------------------------------------------------------------------
%%********************************************************
%system_parameters  
switch (mod_mode)
     mod_out=zeros(1,length(mod_in)/6);
   R=reshape(mod_in,6,length(mod_in)/6);
   B2D=bi2de(R','left-msb')+1;                                         %将二进制转为十进制,注意加1,因为matlab没有a(0)项,而是从a(1)开始      left-msb:表明左边为最高位    --yzh
   Temp=[-7-7*j  -7-5*j  -7-j  -7-3*j  -7+7*j  -7+5*j  -7+j  -7+3*j...  
         -5-7*j  -5-5*j  -5-j  -5-3*j  -5+7*j  -5+5*j  -5+j  -5+3*j... 
         -1-7*j  -1-5*j  -1-j  -1-3*j  -1+7*j  -1+5*j  -1+j  -1+3*j...
         -3-7*j  -3-5*j  -3-j  -3-3*j  -3+7*j  -3+5*j  -3+j  -3+3*j...
          7-7*j   7-5*j   7-j   7-3*j   7+7*j   7+5*j   7+j   7+3*j...
          5-7*j   5-5*j   5-j   5-3*j   5+7*j   5+5*j   5+j   5+3*j...
          1-7*j   1-5*j   1-j   1-3*j   1+7*j   1+5*j   1+j   1+3*j...
          3-7*j   3-5*j   3-j   3-3*j   3+7*j   3+5*j   3+j   3+3*j ];
   for i=1:length(mod_in)/6
       mod_out(i)=Temp(B2D(i))/sqrt(42);
   end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
otherwise
    disp('Error! Please input again');
end
   

⌨️ 快捷键说明

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