rx_qam32_demod.m

来自「BPSK,8PSK,16QAM,32QAM,64QAM的解调程序MATLAB」· M 代码 · 共 36 行

M
36
字号
function hard_bits = rx_qam32_demod(rx_symbols)
%  soft  out

hard_bits = zeros(5, 1);  %Each symbol consists of 5 bits
m=1;
   for k=-5:2:5
      for l=-5:2:5
         table(m) = (k+j*l)/sqrt(20); % power normalization
         m=m+1;
      end;
   end;
table=table( [[2 3 5 4]... 
                [8 9 11 10]... 
                [13 7 18 12] ...
                [14 15 17 16]...
                [32 33 35 34]... 
                [26 27 29 28]...
                [19 25 24 30]...
                [20 21 23 22]]); % Gray code mapping pattern for 32QAM symbols
            
bit0 = real(rx_symbols)>0;            
            
if bit0
   [dis,index]=min(abs( rx_symbols - table(17:32)));
   index=index+16-1;
else
   [dis,index]=min(abs( rx_symbols - table(1:16)));
   index=index-1;
end;

index_str=fliplr(dec2bin(index));
for i=1:length(index_str),
    hard_bits(6-i) = str2num(index_str(i));
end;

⌨️ 快捷键说明

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