www.pudn.com > mimoprecoding.rar > rx_diversity_proc.m, change:2006-07-19,size:8236b


function [data_syms_out, pilot_syms_out] = rx_diversity_proc(freq_data_syms, freq_pilot_syms, ... 
   channel_est, sim_options) 
global sim_consts; 
global codebook_index; 
%remove extra dimension from matrices, if rx diversity is not used 
if ~sim_options.UseRxDiv   %如果没有使用接收分集 
   freq_data_syms = squeeze(freq_data_syms); 
   freq_pilot_syms = squeeze(freq_pilot_syms); 
   if sim_options.UseTxDiv == 2 
       n_ofdm_syms = size(freq_data_syms,2); 
       freq_data_syms = repmat(conj(channel_est(sim_consts.DataSubcPatt,1)), 1, n_ofdm_syms).*freq_data_syms + ... 
           repmat(conj(channel_est(sim_consts.DataSubcPatt,2)), 1, n_ofdm_syms).*freq_data_syms + ... 
           repmat(conj(channel_est(sim_consts.DataSubcPatt,3)), 1, n_ofdm_syms).*freq_data_syms + ... 
           repmat(conj(channel_est(sim_consts.DataSubcPatt,4)), 1, n_ofdm_syms).*freq_data_syms; 
   end 
end 
% tx diversity 
if sim_options.UseTxDiv & (sim_options.UseTxDiv ~= 2)  %如果使用发射分集,但没有使用接收分集 
  % 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 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
if sim_options.UseTxDiv & sim_options.UseRxDiv & (sim_options.UseTxDiv ~= 2) 
   freq_pilot_syms = rx_mr_combiner(freq_pilot_syms, channel_est(sim_consts.PilotSubcPatt,:), sim_options); 
   tmp = size(freq_data_syms); 
   if rem(tmp(3),2) ~= 0 
      %rh_syms(:,n_syms) = []; 
      tmp(3) = tmp(3) - 1; 
   end 
   Rx_OFDM_demodN0 = squeeze(freq_data_syms(1,:,:)); 
   Rx_OFDM_demodN1 = squeeze(freq_data_syms(2,:,:)); 
   H11_Fn =channel_est(sim_consts.DataSubcPatt,1); 
   H12_Fn =channel_est(sim_consts.DataSubcPatt,2); 
   H21_Fn =channel_est(sim_consts.DataSubcPatt,3); 
   H22_Fn =channel_est(sim_consts.DataSubcPatt,4); 
   H11_Fn = repmat(H11_Fn,1,tmp(3)); 
   H12_Fn = repmat(H12_Fn,1,tmp(3)); 
   H21_Fn = repmat(H21_Fn,1,tmp(3)); 
   H22_Fn = repmat(H22_Fn,1,tmp(3)); 
   x = zeros(tmp(2),tmp(3)); 
   for ii = 1:2:tmp(3)  %1/2 symbol per subc  
   %for kk=1:tmp(2)  % subc 48 
      r1_1=Rx_OFDM_demodN0(:,ii); 
      r1_2=Rx_OFDM_demodN0(:,ii+1); 
      r2_1=Rx_OFDM_demodN1(:,ii); 
      r2_2=Rx_OFDM_demodN1(:,ii+1); 
      H11=H11_Fn(:,ii); 
      H12=H12_Fn(:,ii); 
      H21=H21_Fn(:,ii); 
      H22=H22_Fn(:,ii); 
      x(:,ii)=conj(H11).*r1_1+H12.*(conj(r1_2))+conj(H21).*r2_1+H22.*(conj(r2_2)); 
      x(:,ii+1)=conj(H12).*r1_1-H11.*(conj(r1_2))+conj(H22).*r2_1-H21.*(conj(r2_2)); 
   %end 
   end 
    freq_data_syms = x ; 
end 
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%对于4发收 
if sim_options.UseRxDiv   %如果使用接收分集,而没有使用发射分集 
   if sim_options.UseTxDiv == 2  
      %beamCombVec = zeros(52,n_ofdm_syms); 
      beamCombVec = transpose(sim_consts.beamformingvec(:,codebook_index)); 
      reorder = [33:64 1:32]; 
      beamCombVec(reorder,:) = beamCombVec; 
      beamCombVec = beamCombVec(sim_consts.UsedSubcIdx,:); 
      freq_data_syms = rx_fourTotwo(freq_data_syms, channel_est(sim_consts.DataSubcPatt,:), ... 
                              sim_options, beamCombVec(sim_consts.DataSubcPatt,:)); 
      freq_pilot_syms = rx_fourTotwo(freq_pilot_syms, channel_est(sim_consts.PilotSubcPatt,:), ... 
                              sim_options, beamCombVec(sim_consts.PilotSubcPatt,:));    
   end 
end 
%no diversity 
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)); % 1*48*16 
   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 
%Amplitude normalization 
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; 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%    QPSK_constell = [1+i 1-i -1+i -1-i]/(64/sqrt(52)/sqrt(2)); 
%    Rx_ST_decode=[]; 
%    channel_est = channel_est.'; 
%    tmp = size(freq_data_syms); 
%    Rx_OFDM_demodN0 = squeeze(freq_data_syms(1,:,:)); 
%    Rx_OFDM_demodN1 = squeeze(freq_data_syms(2,:,:)); 
%    Rx_OFDM_demodN0 = Rx_OFDM_demodN0(:).'; 
%    Rx_OFDM_demodN1 = Rx_OFDM_demodN1(:).'; 
%     
%    H11_Fn =channel_est(1,:); 
%    H12_Fn =channel_est(2,:); 
%    H21_Fn =channel_est(3,:); 
%    H22_Fn =channel_est(4,:); 
%  
%    H11_Fn = H11_Fn(:,sim_consts.DataSubcPatt); 
%    H12_Fn = H12_Fn(:,sim_consts.DataSubcPatt); 
%    H21_Fn = H21_Fn(:,sim_consts.DataSubcPatt); 
%    H22_Fn = H22_Fn(:,sim_consts.DataSubcPatt); 
%  
%    H11_Fn = repmat(H11_Fn, 1, tmp(3)); 
%    H12_Fn = repmat(H12_Fn, 1, tmp(3)); 
%    H21_Fn = repmat(H21_Fn, 1, tmp(3)); 
%    H22_Fn = repmat(H22_Fn, 1, tmp(3)); 
%  
% for ii=1:10 
%   for kk=1:48 
%       r1_1=Rx_OFDM_demodN0(kk+(ii-1)*96); 
%       r1_2=Rx_OFDM_demodN0(kk+48+(ii-1)*96); 
%       r2_1=Rx_OFDM_demodN1(kk+(ii-1)*96); 
%       r2_2=Rx_OFDM_demodN1(kk+48+(ii-1)*96); 
%        
%       H11_1=H11_Fn(kk+(ii-1)*96); 
%       H11_2=H11_Fn(kk+48+(ii-1)*96); 
%       H12_1=H12_Fn(kk+(ii-1)*96); 
%       H12_2=H12_Fn(kk+48+(ii-1)*96); 
%       H21_1=H21_Fn(kk+(ii-1)*96); 
%       H21_2=H21_Fn(kk+48+(ii-1)*96); 
%       H22_1=H22_Fn(kk+(ii-1)*96); 
%       H22_2=H22_Fn(kk+48+(ii-1)*96); 
%        
%       h11=(1/2)*conj(H11_1+H11_2); 
%       h12=(1/2)*conj(H12_1+H12_2); 
%       h21=(1/2)*conj(H21_1+H21_2); 
%       h22=(1/2)*conj(H22_1+H22_2); 
%             
%       x1=sum(h11*r1_1+h21*r2_1+h12*(conj(r1_1))+h22*(conj(r2_1))); 
%        
%       metric_1 = (abs( x1 - QPSK_constell(1)))^2; 
%       metric_2 = (abs( x1 - QPSK_constell(2)))^2; 
%       metric_3 = (abs( x1 - QPSK_constell(3)))^2; 
%       metric_4 = (abs( x1 - QPSK_constell(4)))^2; 
%       temp_array = [metric_1 metric_2 metric_3 metric_4]; 
%       metric_S1 = min(temp_array); 
%       S1 = QPSK_constell(find(temp_array == metric_S1)); 
%        
%       x2=sum(h12*r1_1+h22*r2_1-(conj(h11))*(conj(r1_2))-(conj(h21))*(conj(r2_2))); 
%       metric_1 = (abs( x2 - QPSK_constell(1)))^2; 
%       metric_2 = (abs( x2 - QPSK_constell(2)))^2; 
%       metric_3 = (abs( x2 - QPSK_constell(3)))^2; 
%       metric_4 = (abs( x2 - QPSK_constell(4)))^2; 
%       temp_array = [metric_1 metric_2 metric_3 metric_4]; 
%       metric_S2 = min(temp_array); 
%       S2 = QPSK_constell(find(temp_array == metric_S2)); 
%       
%       Rx_ST_decode((2*ii-2)*48+kk) = S1; 
%       Rx_ST_decode((2*ii-1)*48+kk) = S2;   
%   end 
% end 
%    pilot_syms_out = freq_pilot_syms; 
%    freq_data_syms = reshape(Rx_ST_decode,48,20); 
%    data_syms_out = freq_data_syms; 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 

2018无需申请注册送58体验金