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

📄 rx_diversity_proc.m

📁 MATLAB Simulation of OFDM System
💻 M
字号:
function [data_syms_out, pilot_syms_out] = rx_diversity_proc(freq_data_syms, freq_pilot_syms, ...
   channel_est, sim_options)
%  freq_data_syms:  n_rx_antennas*48*n_data_syms
%  data_syms_out:  48*n_data_syms
global sim_consts;

% 若没有采用接收分集,移出多余的维。需要注意后面的下标的引用的变化
freq_data_syms = squeeze(freq_data_syms);
freq_pilot_syms = squeeze(freq_pilot_syms);

% tx diversity  发射分集;2×2复分组空时码,即Radon-Hurwitz单位变换。
if sim_options.UseTxDiv
   % Radon-Hurwitz transmit diversity
   if ~sim_options.UseRxDiv
      freq_data_syms = rx_radon_hurwitz(freq_data_syms, channel_est(sim_consts.DataSubcPatt,:));
   elseif sim_options.UseRxDiv
      % Rx R-H performed to both receiver antennas
      freq_data_syms(1,:,:) = rx_radon_hurwitz(squeeze(freq_data_syms(1,:,:)),channel_est(sim_consts.DataSubcPatt,1:2));
      freq_data_syms(2,:,:) = rx_radon_hurwitz(squeeze(freq_data_syms(2,:,:)),channel_est(sim_consts.DataSubcPatt,3:4));
   end
end

% rx diversity  最大比例合并接收分集
if sim_options.UseRxDiv
   if ~sim_options.UseTxDiv
      freq_data_syms = rx_mr_combiner(freq_data_syms, channel_est(sim_consts.DataSubcPatt,:), sim_options);
      freq_pilot_syms = rx_mr_combiner(freq_pilot_syms, channel_est(sim_consts.PilotSubcPatt,:), sim_options);   
   elseif sim_options.UseTxDiv
      freq_data_syms = squeeze(freq_data_syms(1,:,:) + freq_data_syms(2,:,:));
      freq_pilot_syms = rx_mr_combiner(freq_pilot_syms, channel_est(sim_consts.PilotSubcPatt,:), sim_options);
   end
end

% no diversity  若无分集,则接收信号的估计值为R_e=R×conj(H)=S×H×conj(H)=S×abs(H)^2.
if (~sim_options.UseTxDiv) & (~sim_options.UseRxDiv)
   % Data symbols channel correction
   chan_corr_mat = repmat(channel_est(sim_consts.DataSubcPatt), 1, size(freq_data_syms,2));
   freq_data_syms = freq_data_syms.*conj(chan_corr_mat);
   chan_corr_mat = repmat(channel_est(sim_consts.PilotSubcPatt), 1, size(freq_pilot_syms,2));
   freq_pilot_syms = freq_pilot_syms.*conj(chan_corr_mat);
end

% 幅度归一化
%注意在对接收信号进行估计时,结果都是发射信号乘了一个|H|^2的形式,故需要归一化.
chan_sq_amplitude = sum(abs(channel_est(sim_consts.DataSubcPatt,:)).^2, 2);
chan_sq_amplitude_mtx = repmat(chan_sq_amplitude,1, size(freq_data_syms,2));

data_syms_out = freq_data_syms./chan_sq_amplitude_mtx;

chan_sq_amplitude = sum(abs(channel_est(sim_consts.PilotSubcPatt,:)).^2, 2);
chan_sq_amplitude_mtx = repmat(chan_sq_amplitude,1, size(freq_pilot_syms,2));
pilot_syms_out = freq_pilot_syms./chan_sq_amplitude_mtx;

%keyboard

⌨️ 快捷键说明

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