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

📄 qamdemod.m

📁 OFDM信道估计和均衡的仿真程序
💻 M
字号:
%+----------------------------------------------------------------+
%|                                                                |
%|  Name: qamdemod.m                                              |
%|  Author: Mathew Liu, James Shen                                |
%|  Description: Takes in 'in_symbol' which can be noisy, ie      |
%|  it does not lie on the original constellation. We map it to   |
%|  the closest symbol in the constellation, find it's index in   |
%|  the QAM alphabet array and turn it back into a binary.        |
%|                                                                |
%+----------------------------------------------------------------+

function[out_binary] = qamdemod(in_symbols, carrier_count, M)

%================ Generate QAM alphabet again =================
temp_M = -(M-1):2:(M-1); % Generate QAM Alphabet
for i=1:M
    for k = 1:M
        QAM(i,k) = temp_M(i) + j*temp_M(k);
    end
end
QAM_alpha = QAM(:).';

%========= Map Symbol to Constellation and Dec2Bin ============
for row=1:carrier_count

  	[out_symbol, index] = closest(QAM_alpha, in_symbols(row));
    
    index = index - 1; 
    % The index is always 1 more than the binary number since the 
    % index needs to start with one, where as the binary data can be 0.
    
	% Decimal to Binary conversion
    for bit_position = M:-1:1
   	    if (index >= 2^(bit_position-1))
            out_binary(row,bit_position) = 1;
            index = index - 2^(bit_position-1);
        else
            out_binary(row,bit_position) = 0;
        end
    end
   
end

%====================== End File =================================

⌨️ 快捷键说明

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