qam4.m

来自「QAM 4 Modulator and Demodulator based on」· M 代码 · 共 36 行

M
36
字号

% Function for 16 - QAM Modulation Take a minimum 1*4 element  input to
% Modulate 
% i_qam use for input
% o_qam use for output of qam

function o_qam = qam4(i_qam)
% disp('QAM 16 modulation');
  temp  = size(i_qam);
  row   = temp(1);
  colom = temp(2);
  %o_qam = null;
  
  %database of QAM Mapping
  %         0   1   2    3  
  qam_arr=[1+j 1-j -1+j -1-j];
  
  
for iq=1:row
    %converting the binary to decimal 
    % 0000     ....  0  qam produce -3 - 3i
      
    %decimal conversion  MSB ----- > LSB
    
%       decimal = i_qam(iq,4) + 2 * i_qam(iq,3) + 4 * i_qam(iq,2) + 8 * i_qam(iq,1)  ; 
    dec = i_qam(iq);
     %disp('decimal');
     %disp(decimal) ;
              
             % o_qam(iq,1) = qam_arr(decimal+1) ;
              o_qam(iq,:) = qam_arr(dec+1) ;
      % disp(o_qam(iq) );
      % disp('ok');
end                   
 end %end of qam function

⌨️ 快捷键说明

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