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

📄 vblasttrans_2tx2rxintp.m

📁 ofdm_EM_channel OFDM信道估计源代码
💻 M
字号:
function [rec_freq_Signal_nopilot,H11_esti,H12_esti,H21_esti,H22_esti] = VblastTrans_2Tx2Rx(rec_freq_Signal1,rec_freq_Signal2,P_dSource_tr1,P_dSource_tr2,H11,H12,H21,H22,snr_indB)
   %=============下面定义信道
     tmp = size(rec_freq_Signal1);
     %reshape(rec_freq_Signal1,1,tmp(1)*tmp(2));
     %reshape(rec_freq_Signal2,1,tmp(1)*tmp(2));
     %reshape(H11,1,tmp(1)*tmp(2));
     %reshape(H12,1,tmp(1)*tmp(2));
     %reshape(H21,1,tmp(1)*tmp(2));
     %reshape(H22,1,tmp(1)*tmp(2));
     
     %for n = 1: tmp(1)*tmp(2)
     Dist = 21;
     pilotNUM = floor(tmp(2)/Dist);%相当于已知了几个信道的意思
     H11_esti = ones(tmp);
     H12_esti = ones(tmp);
     H21_esti = ones(tmp);
     H22_esti = ones(tmp);
     
     if pilotNUM*Dist +1 <= tmp(2)
         pilotNUM = pilotNUM +1;
     end
   for k=1:pilotNUM
    %channel11(:,k) = awgn(H11(:,Dist*(k-1)+1),2*snr_indB,'measured');
    %channel21(:,k) = awgn(H21(:,Dist*(k-1)+1),2*snr_indB,'measured');
    %channel12(:,k) = awgn(H12(:,Dist*(k-1)+1),2*snr_indB,'measured');
    %channel22(:,k) = awgn(H22(:,Dist*(k-1)+1),2*snr_indB,'measured');
    %channel11(:,k+1) = awgn(H11(:,Dist*(k-1)+1),2*snr_indB,'measured');
    %channel21(:,k+1) = awgn(H21(:,Dist*(k-1)+1),2*snr_indB,'measured');
    %channel12(:,k+1) = awgn(H12(:,Dist*(k-1)+1),2*snr_indB,'measured');
    %channel22(:,k+1) = awgn(H22(:,Dist*(k-1)+1),2*snr_indB,'measured');
    %H11_esti(:,Dist*(k-1)+1) = awgn(H11(:,Dist*(k-1)+1),2*snr_indB,'measured');
    %H21_esti(:,Dist*(k-1)+1) = awgn(H21(:,Dist*(k-1)+1),2*snr_indB,'measured');
    %H12_esti(:,Dist*(k-1)+1) = awgn(H12(:,Dist*(k-1)+1),2*snr_indB,'measured');
    %H22_esti(:,Dist*(k-1)+1) = awgn(H22(:,Dist*(k-1)+1),2*snr_indB,'measured');
    
    H11_esti(:,Dist*(k-1)+1) =( rec_freq_Signal1(:,Dist*(k-1)+1) - H21(:,Dist*(k-1)+1).* P_dSource_tr2(:,Dist*(k-1)+1) )./P_dSource_tr1(:,Dist*(k-1)+1) ;
    H12_esti(:,Dist*(k-1)+1) =( rec_freq_Signal2(:,Dist*(k-1)+1) - H22(:,Dist*(k-1)+1).* P_dSource_tr2(:,Dist*(k-1)+1) )./P_dSource_tr1(:,Dist*(k-1)+1) ;
    H21_esti(:,Dist*(k-1)+1) =( rec_freq_Signal1(:,Dist*(k-1)+1) - H11(:,Dist*(k-1)+1).* P_dSource_tr1(:,Dist*(k-1)+1) )./P_dSource_tr2(:,Dist*(k-1)+1) ;
    H22_esti(:,Dist*(k-1)+1) =( rec_freq_Signal2(:,Dist*(k-1)+1) - H12(:,Dist*(k-1)+1).* P_dSource_tr1(:,Dist*(k-1)+1) )./P_dSource_tr2(:,Dist*(k-1)+1) ;
  end
  if Dist ~= 1
  for k = 1:pilotNUM -1
   for kk=1:Dist-1
        H11_esti(:,Dist*(k-1)+1+kk) = (H11_esti(:,Dist*(k-1)+1)*(Dist-kk)+H11_esti(:,Dist*k+1)*kk)/Dist;
        H21_esti(:,Dist*(k-1)+1+kk) = (H21_esti(:,Dist*(k-1)+1)*(Dist-kk)+H21_esti(:,Dist*k+1)*kk)/Dist;
        H12_esti(:,Dist*(k-1)+1+kk) = (H12_esti(:,Dist*(k-1)+1)*(Dist-kk)+H12_esti(:,Dist*k+1)*kk)/Dist;
        H22_esti(:,Dist*(k-1)+1+kk) = (H22_esti(:,Dist*(k-1)+1)*(Dist-kk)+H22_esti(:,Dist*k+1)*kk)/Dist;
   end
end
   kkk =pilotNUM-1;
  channel111 = repmat(H11_esti(:,Dist*kkk+1),1,tmp(2)-Dist*kkk);
  channel211 = repmat(H21_esti(:,Dist*kkk+1),1,tmp(2)-Dist*kkk);
  channel121 = repmat(H12_esti(:,Dist*kkk+1),1,tmp(2)-Dist*kkk);
  channel221 = repmat(H22_esti(:,Dist*kkk+1),1,tmp(2)-Dist*kkk);
  H11_esti(:,Dist*kkk+1:tmp(2)) = channel111;
  H21_esti(:,Dist*kkk+1:tmp(2)) = channel211;
  H12_esti(:,Dist*kkk+1:tmp(2)) = channel121;
  H22_esti(:,Dist*kkk+1:tmp(2)) = channel221;   
end
  %H11_esti = H11;
     %H12_esti = H12;
     %H21_esti = H21;
     %H22_esti = H22;
for n = 1:1
 for m = 1:tmp(1)
         H = [H11_esti(m,n),H21_esti(m,n);H12_esti(m,n),H22_esti(m,n)];
         
         r1 = rec_freq_Signal1(m,n);
         r2 = rec_freq_Signal2(m,n);
         r = [r1;r2];
     %=================对信道正交性的理解
     G = pinv(H);
     test = H * G;
     G1 = G(1,:);
     G2 = G(2,:);
     test1 = G2 * H(:,2);
     test2 = G2 * H(:,1);   
     %===================下面进行ZF检测%
    norm1 = norm(G1);
    norm2 = norm(G2);
     if norm1 > norm2
         w1 = G(2,:);
         y2_soft = w1 * r ;
         y2 = myslice(y2_soft);
         r = r -  H(:,2) * y2;
         H(:,2) = [0,0]';
         G = pinv(H);
         w2 = G(1,:);
         y1_soft = w2 * r;
         y1 = myslice(y1_soft);
     else
         w1 = G(1,:);
         y1_soft = w1 * r ;
         y1 = myslice(y1_soft);
         r = r -  H(:,1) * y1;
         H(:,1) = [0,0]';
         G = pinv(H);
         w2 = G(2,:);
         y2_soft = w2 * r;
         y2 = myslice(y2_soft);
     end
     rec_freq_Signal_nopilot1(m,n) = y1;
     rec_freq_Signal_nopilot2(m,n) = y2;
 end
end

for n = 2:tmp(2)
 for m = 1:tmp(1)
         H = [H11_esti(m,n),H21_esti(m,n);H12_esti(m,n),H22_esti(m,n)];
         
         r1 = rec_freq_Signal1(m,n);
         r2 = rec_freq_Signal2(m,n);
         r = [r1;r2];
     %=================对信道正交性的理解
     G = pinv(H);
     test = H * G;
     G1 = G(1,:);
     G2 = G(2,:);
     test1 = G2 * H(:,2);
     test2 = G2 * H(:,1);   
     %===================下面进行ZF检测%
    norm1 = norm(G1);
    norm2 = norm(G2);
     if norm1 > norm2
         w1 = G(2,:);
         y2_soft = w1 * r ;
         y2 = myslice(y2_soft);
         r = r -  H(:,2) * y2;
         H(:,2) = [0,0]';
         G = pinv(H);
         w2 = G(1,:);
         y1_soft = w2 * r;
         y1 = myslice(y1_soft);
     else
         w1 = G(1,:);
         y1_soft = w1 * r ;
         y1 = myslice(y1_soft);
         r = r -  H(:,1) * y1;
         H(:,1) = [0,0]';
         G = pinv(H);
         w2 = G(2,:);
         y2_soft = w2 * r;
         y2 = myslice(y2_soft);
     end
     rec_freq_Signal_nopilot1(m,n) = y1;
     rec_freq_Signal_nopilot2(m,n) = y2;
  end
 end
 
 
 
 %rec_freq_Signal_nopilot1 = reshape(rec_freq_Signal_nopilot1,tmp(1),tmp(2));
 %rec_freq_Signal_nopilot2 = reshape(rec_freq_Signal_nopilot2,tmp(1),tmp(2));
 rec_freq_Signal_nopilot = [rec_freq_Signal_nopilot1;rec_freq_Signal_nopilot2];
 

⌨️ 快捷键说明

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