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

📄 demodulate.m

📁 matlab编写的MIMO-OFDM仿真程序
💻 M
字号:
function y = demodulate(x,b,e,h,s2,s4,s16,s64,s256,c2,c4,c16,c64,c256);
%function y = demodulate(x,b,e,h,s2,s4,s16,s64,s256,c2,c4,c16,c64,c256)
%
%找到距离接收信号最近的码字用二进制输出,使用迫零算法
%
%   y ----调制输出,以行的形式
%   x ----调制输入,以行的形式
%   h ----所有子信道信道值(频域,64个值) 
%   b ----子载波分配的比特(在这个矩阵里有64个元素,每个反映每个子载波所分配的比特数
%   e ----分配的能量(64个元素) 
%   s_ ----星座大小
%   c_ ----码字

y = [];
 
for i = 1:length(b)
    switch b(i)
        case{1}
            [tmp,index] = min(abs(s2-1/h(i)/sqrt(e(i))*x(i)));
            y = [y c2(index,:)];
        case{2}
            [tmp,index] = min(abs(s4-1/h(i)/sqrt(e(i))*x(i)));
            y = [y c4(index,:)];
        case{4}
            [tmp,index] = min(abs(s16-1/h(i)/sqrt(e(i))*x(i)));
            y = [y c16(index,:)];
        case{6}
            [tmp,index] = min(abs(s64-1/h(i)/sqrt(e(i))*x(i)));
            y = [y c64(index,:)];
        case{8}
            [tmp,index] = min(abs(s256-1/h(i)/sqrt(e(i))*x(i)));
            y = [y c256(index,:)];
        otherwise
            index = 0;
    end
end

⌨️ 快捷键说明

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