estimator_linear_comb.m
资源名称:MIMO-OFDM.rar [点击查看]
上传用户:look542
上传日期:2009-06-04
资源大小:784k
文件大小:5k
源码类别:
传真(Fax)编程
开发平台:
Matlab
- function [H_est,H_frame2]=estimator_linear_comb(pilot_sym,known_pilot,idx_cir,N_Rx_ant,N_Tx_ant,...
- Pos_pilot,N_ts,N_sym_ts,Pos_data, Pos_pilot_sym,N_subc,N_data_sym_ts,L_delay,SwitchOrthogonalPilot)
- if SwitchOrthogonalPilot == 1
- algorithm = 2; % 1 or 2.
- elseif SwitchOrthogonalPilot == 0
- algorithm = 4; % 3 or 4.
- end
- for ts=1:N_ts
- if algorithm == 1
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Orthogonal
- R1=pilot_sym(:,(ts-1)*N_ts+1,1)+pilot_sym(:,(ts-1)*N_ts+2,1);
- R1=R1/2;
- H1=R1./known_pilot(:,(ts-1)*N_ts+1,1);
- R2=pilot_sym(:,(ts-1)*N_ts+1,1)-pilot_sym(:,(ts-1)*N_ts+2,1);
- R2=R2/2;
- H2=R2./known_pilot(:,(ts-1)*N_ts+1,1);
- R3=pilot_sym(:,(ts-1)*N_ts+1,2)+pilot_sym(:,(ts-1)*N_ts+2,2);
- R3=R3/2;
- H3=R3./known_pilot(:,(ts-1)*N_ts+1,1);
- R4=pilot_sym(:,(ts-1)*N_ts+1,2)-pilot_sym(:,(ts-1)*N_ts+2,2);
- R4=R4/2;
- H4=R4./known_pilot(:,(ts-1)*N_ts+1,1);
- H_frame(:,ts,1)=H1;
- H_frame(:,ts,2)=H2;
- H_frame(:,ts,3)=H3;
- H_frame(:,ts,4)=H4;
- elseif algorithm == 2
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Orthogonal + DFT
- R1=pilot_sym(:,(ts-1)*N_ts+1,1)+pilot_sym(:,(ts-1)*N_ts+2,1);
- R1=R1/2;
- H1=R1./known_pilot(:,(ts-1)*N_ts+1,1);
- H1=LS_DFT(N_subc,H1,L_delay);
- R2=pilot_sym(:,(ts-1)*N_ts+1,1)-pilot_sym(:,(ts-1)*N_ts+2,1);
- R2=R2/2;
- H2=R2./known_pilot(:,(ts-1)*N_ts+1,1);
- H2=LS_DFT(N_subc,H2,L_delay);
- R3=pilot_sym(:,(ts-1)*N_ts+1,2)+pilot_sym(:,(ts-1)*N_ts+2,2);
- R3=R3/2;
- H3=R3./known_pilot(:,(ts-1)*N_ts+1,1);
- H3=LS_DFT(N_subc,H3,L_delay);
- R4=pilot_sym(:,(ts-1)*N_ts+1,2)-pilot_sym(:,(ts-1)*N_ts+2,2);
- R4=R4/2;
- H4=R4./known_pilot(:,(ts-1)*N_ts+1,1);
- H4=LS_DFT(N_subc,H4,L_delay);
- H_frame(:,ts,1)=H1;
- H_frame(:,ts,2)=H2;
- H_frame(:,ts,3)=H3;
- H_frame(:,ts,4)=H4;
- elseif algorithm == 3
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Non-orthogonal
- X11 = diag( known_pilot(:,(ts-1)*N_ts+1,1) );
- X12 = diag( known_pilot(:,(ts-1)*N_ts+2,1) );
- X21 = diag( known_pilot(:,(ts-1)*N_ts+1,2) );
- X22 = diag( known_pilot(:,(ts-1)*N_ts+2,2) );
- Y11 = pilot_sym(:,(ts-1)*N_ts+1,1) ;
- Y12 = pilot_sym(:,(ts-1)*N_ts+2,1) ;
- Y21 = pilot_sym(:,(ts-1)*N_ts+1,2) ;
- Y22 = pilot_sym(:,(ts-1)*N_ts+2,2) ;
- X_tmp = [conj(X11)*X11+conj(X12)*X12 conj(X11)*X21+conj(X12)*X22 ; ...
- conj(X21)*X11+conj(X22)*X12 conj(X21)*X21+conj(X22)*X22 ] ;
- Y1_tmp = [conj(X11)*Y11+conj(X12)*Y12 ;...
- conj(X21)*Y11+conj(X22)*Y12 ];
- Y2_tmp = [conj(X11)*Y21+conj(X12)*Y22 ;...
- conj(X21)*Y21+conj(X22)*Y22 ];
- H_r1 = inv(X_tmp) * Y1_tmp; % Hou's method
- H_r2 = inv(X_tmp) * Y2_tmp;
- %H_r1 = pinv([X11 X21; X12 X22])*[Y11;Y12]; % Zhao's method.
- %H_r2 = pinv([X11 X21; X12 X22])*[Y21;Y22];
- H11 = H_r1(1:N_subc);
- H21 = H_r1(N_subc + 1:2*N_subc);
- H12 = H_r2(1:N_subc);
- H22 = H_r2(N_subc + 1:2*N_subc);
- H_frame(:,ts,1)=H11;
- H_frame(:,ts,2)=H21;
- H_frame(:,ts,3)=H12;
- H_frame(:,ts,4)=H22;
- elseif algorithm == 4
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Non-orthogonal + DFT
- X11 = diag( known_pilot(:,(ts-1)*N_ts+1,1) );
- X12 = diag( known_pilot(:,(ts-1)*N_ts+2,1) );
- X21 = diag( known_pilot(:,(ts-1)*N_ts+1,2) );
- X22 = diag( known_pilot(:,(ts-1)*N_ts+2,2) );
- Y11 = pilot_sym(:,(ts-1)*N_ts+1,1) ;
- Y12 = pilot_sym(:,(ts-1)*N_ts+2,1) ;
- Y21 = pilot_sym(:,(ts-1)*N_ts+1,2) ;
- Y22 = pilot_sym(:,(ts-1)*N_ts+2,2) ;
- X_tmp = [conj(X11)*X11+conj(X12)*X12 conj(X11)*X21+conj(X12)*X22 ; ...
- conj(X21)*X11+conj(X22)*X12 conj(X21)*X21+conj(X22)*X22 ] ;
- Y1_tmp = [conj(X11)*Y11+conj(X12)*Y12 ;...
- conj(X21)*Y11+conj(X22)*Y12 ];
- Y2_tmp = [conj(X11)*Y21+conj(X12)*Y22 ;...
- conj(X21)*Y21+conj(X22)*Y22 ];
- H_r1 = pinv(X_tmp) * Y1_tmp; % Hou's method
- H_r2 = pinv(X_tmp) * Y2_tmp;
- %H_r1 = pinv([X11 X21; X12 X22])*[Y11;Y12]; % Zhao's method.
- %H_r2 = pinv([X11 X21; X12 X22])*[Y21;Y22];
- H11 = H_r1(1:N_subc);
- H21 = H_r1(N_subc + 1:2*N_subc);
- H12 = H_r2(1:N_subc);
- H22 = H_r2(N_subc + 1:2*N_subc);
- H11 = LS_DFT(N_subc,H11,L_delay);
- H21 = LS_DFT(N_subc,H21,L_delay);
- H12 = LS_DFT(N_subc,H12,L_delay);
- H22 = LS_DFT(N_subc,H22,L_delay);
- H_frame(:,ts,1)=H11;
- H_frame(:,ts,2)=H21;
- H_frame(:,ts,3)=H12;
- H_frame(:,ts,4)=H22;
- end
- end
- Pos_pilot = [1 8] ;
- for nr = 1:N_Rx_ant
- for nt = 1:N_Tx_ant
- H_frame2(:,:,(nr-1)*N_Tx_ant+nt) = ( interp1(Pos_pilot.',H_frame(:,:,(nr-1)*N_Tx_ant+nt).',...
- [1:N_ts*N_sym_ts]','linear','extrap') ).';
- end
- end
- H_est = zeros( N_subc, N_data_sym_ts*N_ts ,N_Tx_ant*N_Rx_ant );
- H_est = H_frame2(:,Pos_data,:);