www.pudn.com > mimoprecoding.rar > get_channel_ir.m, change:2006-07-01,size:3218b


function cir = get_channel_ir(sim_options); 
global sim_consts; 
[n_tx_antennas, n_rx_antennas] = get_n_antennas(sim_options);%获取天线数量 
n_channels = n_tx_antennas*n_rx_antennas;%信道的数量 
if ~isempty(findstr(sim_options.ChannelModel, 'ExponentialDecay')) 
   if sim_options.ExpDecayTrms == 0 
      Kmax = 0; 
      vark = 1; 
   else 
      % Calculate the exponential decay envelope 
      Kmax = ceil( 10 * (sim_options.ExpDecayTrms*(1e-9))*sim_consts.SampFreq); 
      var0 = (1 - exp( - 1/(sim_consts.SampFreq*(sim_options.ExpDecayTrms*(1e-9))))) / ... 
         (1 - exp( -1*((Kmax+1)*sim_consts.SampFreq/(sim_options.ExpDecayTrms*(1e-9))))); 
      k = (0:Kmax); 
      env = var0 * exp( - k/(sim_consts.SampFreq*(sim_options.ExpDecayTrms*(1e-9)))); 
   end 
   stdDevReOrIm = sqrt(env/2); 
   cir = repmat(stdDevReOrIm, n_channels,1) .* (randn(n_channels, Kmax+1) + j*randn(n_channels, Kmax+1)); 
elseif ~isempty(findstr(sim_options.ChannelModel, 'AWGN')) 
   cir = ones(n_channels,1);%对于AWGN信道,冲击响应为1 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
elseif ~isempty(findstr(sim_options.ChannelModel, 'Rayleigh')) 
    H_int = 1/sqrt(2)*(randn(n_rx_antennas*length(sim_options.A),n_tx_antennas) ... 
        + j*randn(n_rx_antennas*length(sim_options.A),n_tx_antennas)); 
    H_int2=[]; 
  for i = 1:length(sim_options.A) 
    H_int2 = [H_int2;sqrt(sim_options.A(i))*H_int((i-1)*n_rx_antennas+1:i*n_rx_antennas,:)]; 
  end 
%     H_int2 = [H_int2;zeros((sim_consts.NumSubc-length(sim_options.A))*n_rx_antennas,n_tx_antennas)]; 
%  
%     H_f = zeros(n_rx_antennas,n_tx_antennas*(sim_consts.NumSubc-16)); 
%   for i = 1:n_tx_antennas 
%     for x = 1:n_rx_antennas 
%         h_f = fft(H_int2(x:n_rx_antennas:(sim_consts.NumSubc-16-1)*n_rx_antennas+x,i)); 
%         for k = 1:(sim_consts.NumSubc-16) 
%             H_f(x,i+(k-1)*n_tx_antennas) = h_f(k); 
%         end 
%     end 
%   end 
%  
%     H=[H_int2]; 
%   for i = 1:sim_consts.NumSubc-1 
%     H=[H,[zeros(n_rx_antennas*i,n_tx_antennas);H_int2(1:(sim_consts.NumSubc-i)*n_rx_antennas,:)]]; 
%   end 
   [temp_r temp_c] = size(H_int2); 
   pattern = [1:2:temp_r;2:2:temp_r]; 
   cir1 = H_int2(pattern(1,:),:); 
   cir2 = H_int2(pattern(2,:),:); 
   cir = [cir1,cir2]; 
   cir = transpose(cir); 
%    cir = repmat(H,n_channels,1); 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
elseif ~isempty(findstr(sim_options.ChannelModel, 'Multipath')) 
    % amplitudes of 5 multipath arrivals  
    a=[0.6154    0.7919    0.9218    0.7382    0.1763];   
    % arrival times of 5 multipath arrivals  
    t=[0.9169    0.4103    0.8936    0.0579    0.3529];   
    i=0; % frequency index  
    for  omega=1:0.1:10; % angular freuencies  
       multipath_arrival=a.*exp(j*omega*t);  
       i=i+1;  
       abs_H(i)=abs(sum(multipath_arrival)); % the i-th transfer function  
    end 
    cir = ifft(abs_H); 
    K = size(cir,2); 
    cir = repmat(cir ,n_channels ,1).* (randn(n_channels, K) + j*randn(n_channels, K)); 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
else 
   error('Undefined channel model'); 
end 

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