estimator_linear_comb.m
上传用户:look542
上传日期:2009-06-04
资源大小:784k
文件大小:5k
源码类别:

传真(Fax)编程

开发平台:

Matlab

  1. function [H_est,H_frame2]=estimator_linear_comb(pilot_sym,known_pilot,idx_cir,N_Rx_ant,N_Tx_ant,...
  2.     Pos_pilot,N_ts,N_sym_ts,Pos_data, Pos_pilot_sym,N_subc,N_data_sym_ts,L_delay,SwitchOrthogonalPilot)
  3. if SwitchOrthogonalPilot == 1
  4.     algorithm = 2;      % 1 or 2.
  5. elseif SwitchOrthogonalPilot == 0
  6.     algorithm = 4;      % 3 or 4.
  7. end
  8. for ts=1:N_ts
  9.     
  10.     if algorithm == 1
  11.         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Orthogonal 
  12.         R1=pilot_sym(:,(ts-1)*N_ts+1,1)+pilot_sym(:,(ts-1)*N_ts+2,1);
  13.         R1=R1/2;
  14.         H1=R1./known_pilot(:,(ts-1)*N_ts+1,1);
  15.         R2=pilot_sym(:,(ts-1)*N_ts+1,1)-pilot_sym(:,(ts-1)*N_ts+2,1);
  16.         R2=R2/2;
  17.         H2=R2./known_pilot(:,(ts-1)*N_ts+1,1);
  18.         R3=pilot_sym(:,(ts-1)*N_ts+1,2)+pilot_sym(:,(ts-1)*N_ts+2,2);
  19.         R3=R3/2;
  20.         H3=R3./known_pilot(:,(ts-1)*N_ts+1,1);
  21.         R4=pilot_sym(:,(ts-1)*N_ts+1,2)-pilot_sym(:,(ts-1)*N_ts+2,2);
  22.         R4=R4/2;
  23.         H4=R4./known_pilot(:,(ts-1)*N_ts+1,1);
  24.         H_frame(:,ts,1)=H1;
  25.         H_frame(:,ts,2)=H2;
  26.         H_frame(:,ts,3)=H3;
  27.         H_frame(:,ts,4)=H4;
  28.         
  29.     elseif algorithm == 2
  30.         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Orthogonal + DFT
  31.         R1=pilot_sym(:,(ts-1)*N_ts+1,1)+pilot_sym(:,(ts-1)*N_ts+2,1);
  32.         R1=R1/2;
  33.         H1=R1./known_pilot(:,(ts-1)*N_ts+1,1);
  34.         H1=LS_DFT(N_subc,H1,L_delay);
  35.         R2=pilot_sym(:,(ts-1)*N_ts+1,1)-pilot_sym(:,(ts-1)*N_ts+2,1);
  36.         R2=R2/2;
  37.         H2=R2./known_pilot(:,(ts-1)*N_ts+1,1);
  38.         H2=LS_DFT(N_subc,H2,L_delay);
  39.         R3=pilot_sym(:,(ts-1)*N_ts+1,2)+pilot_sym(:,(ts-1)*N_ts+2,2);
  40.         R3=R3/2;
  41.         H3=R3./known_pilot(:,(ts-1)*N_ts+1,1);
  42.         H3=LS_DFT(N_subc,H3,L_delay);
  43.         R4=pilot_sym(:,(ts-1)*N_ts+1,2)-pilot_sym(:,(ts-1)*N_ts+2,2);
  44.         R4=R4/2;
  45.         H4=R4./known_pilot(:,(ts-1)*N_ts+1,1);
  46.         H4=LS_DFT(N_subc,H4,L_delay);
  47.         H_frame(:,ts,1)=H1;
  48.         H_frame(:,ts,2)=H2;
  49.         H_frame(:,ts,3)=H3;
  50.         H_frame(:,ts,4)=H4;
  51.         
  52.     elseif algorithm == 3
  53.         
  54.         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Non-orthogonal
  55.         
  56.         X11 = diag( known_pilot(:,(ts-1)*N_ts+1,1) );
  57.         X12 = diag( known_pilot(:,(ts-1)*N_ts+2,1) );
  58.         X21 = diag( known_pilot(:,(ts-1)*N_ts+1,2) );
  59.         X22 = diag( known_pilot(:,(ts-1)*N_ts+2,2) );
  60.         
  61.         Y11 = pilot_sym(:,(ts-1)*N_ts+1,1) ;
  62.         Y12 = pilot_sym(:,(ts-1)*N_ts+2,1) ;
  63.         Y21 = pilot_sym(:,(ts-1)*N_ts+1,2) ;
  64.         Y22 = pilot_sym(:,(ts-1)*N_ts+2,2) ;
  65.         
  66.         X_tmp = [conj(X11)*X11+conj(X12)*X12 conj(X11)*X21+conj(X12)*X22 ; ...
  67.                 conj(X21)*X11+conj(X22)*X12 conj(X21)*X21+conj(X22)*X22 ] ;
  68.         
  69.         Y1_tmp = [conj(X11)*Y11+conj(X12)*Y12 ;...
  70.                 conj(X21)*Y11+conj(X22)*Y12 ];
  71.         
  72.         Y2_tmp = [conj(X11)*Y21+conj(X12)*Y22 ;...
  73.                 conj(X21)*Y21+conj(X22)*Y22 ];
  74.         
  75.         H_r1 = inv(X_tmp) * Y1_tmp;         % Hou's method 
  76.         H_r2 = inv(X_tmp) * Y2_tmp; 
  77.         
  78.         %H_r1 = pinv([X11 X21; X12 X22])*[Y11;Y12];   % Zhao's method.
  79.         %H_r2 = pinv([X11 X21; X12 X22])*[Y21;Y22];    
  80.         
  81.         H11 = H_r1(1:N_subc);
  82.         H21 = H_r1(N_subc + 1:2*N_subc); 
  83.         H12 = H_r2(1:N_subc);
  84.         H22 = H_r2(N_subc + 1:2*N_subc); 
  85.         
  86.         H_frame(:,ts,1)=H11;
  87.         H_frame(:,ts,2)=H21;
  88.         H_frame(:,ts,3)=H12;
  89.         H_frame(:,ts,4)=H22;
  90.         
  91.     elseif algorithm == 4
  92.         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Non-orthogonal + DFT
  93.         X11 = diag( known_pilot(:,(ts-1)*N_ts+1,1) );
  94.         X12 = diag( known_pilot(:,(ts-1)*N_ts+2,1) );
  95.         X21 = diag( known_pilot(:,(ts-1)*N_ts+1,2) );
  96.         X22 = diag( known_pilot(:,(ts-1)*N_ts+2,2) );
  97.         
  98.         Y11 = pilot_sym(:,(ts-1)*N_ts+1,1) ;
  99.         Y12 = pilot_sym(:,(ts-1)*N_ts+2,1) ;
  100.         Y21 = pilot_sym(:,(ts-1)*N_ts+1,2) ;
  101.         Y22 = pilot_sym(:,(ts-1)*N_ts+2,2) ;
  102.         
  103.         X_tmp = [conj(X11)*X11+conj(X12)*X12 conj(X11)*X21+conj(X12)*X22 ; ...
  104.                 conj(X21)*X11+conj(X22)*X12 conj(X21)*X21+conj(X22)*X22 ] ;
  105.         
  106.         Y1_tmp = [conj(X11)*Y11+conj(X12)*Y12 ;...
  107.                 conj(X21)*Y11+conj(X22)*Y12 ];
  108.         
  109.         Y2_tmp = [conj(X11)*Y21+conj(X12)*Y22 ;...
  110.                 conj(X21)*Y21+conj(X22)*Y22 ];
  111.         
  112.         H_r1 = pinv(X_tmp) * Y1_tmp;             % Hou's method 
  113.         H_r2 = pinv(X_tmp) * Y2_tmp; 
  114.         
  115.         %H_r1 = pinv([X11 X21; X12 X22])*[Y11;Y12];     % Zhao's method.
  116.         %H_r2 = pinv([X11 X21; X12 X22])*[Y21;Y22];    
  117.         
  118.         H11 = H_r1(1:N_subc);
  119.         H21 = H_r1(N_subc + 1:2*N_subc); 
  120.         H12 = H_r2(1:N_subc);
  121.         H22 = H_r2(N_subc + 1:2*N_subc); 
  122.         
  123.         H11 = LS_DFT(N_subc,H11,L_delay);
  124.         H21 = LS_DFT(N_subc,H21,L_delay);
  125.         H12 = LS_DFT(N_subc,H12,L_delay);
  126.         H22 = LS_DFT(N_subc,H22,L_delay);
  127.         
  128.         H_frame(:,ts,1)=H11;
  129.         H_frame(:,ts,2)=H21;
  130.         H_frame(:,ts,3)=H12;
  131.         H_frame(:,ts,4)=H22;
  132.         
  133.     end
  134.     
  135. end
  136. Pos_pilot = [1 8] ;
  137. for nr = 1:N_Rx_ant
  138.     for nt = 1:N_Tx_ant
  139.         H_frame2(:,:,(nr-1)*N_Tx_ant+nt) = ( interp1(Pos_pilot.',H_frame(:,:,(nr-1)*N_Tx_ant+nt).',...
  140.             [1:N_ts*N_sym_ts]','linear','extrap') ).'; 
  141.     end
  142. end
  143. H_est = zeros( N_subc, N_data_sym_ts*N_ts ,N_Tx_ant*N_Rx_ant );
  144. H_est = H_frame2(:,Pos_data,:);