?? dem_dfusc_4x2_stbc.m
字號:
mse=mse+sum(abs(PwNorm*perfectCE_11(frm,:)-FullChanEst_11).^2)/1703 ...
+sum(abs(PwNorm*perfectCE_21(frm,:)-FullChanEst_21).^2)/1703 ...
+sum(abs(PwNorm*perfectCE_31(frm,:)-FullChanEst_31).^2)/1703 ...
+sum(abs(PwNorm*perfectCE_41(frm,:)-FullChanEst_41).^2)/1703 ...
+sum(abs(PwNorm*perfectCE_12(frm,:)-FullChanEst_12).^2)/1703 ...
+sum(abs(PwNorm*perfectCE_22(frm,:)-FullChanEst_22).^2)/1703 ...
+sum(abs(PwNorm*perfectCE_32(frm,:)-FullChanEst_32).^2)/1703 ...
+sum(abs(PwNorm*perfectCE_42(frm,:)-FullChanEst_42).^2)/1703;
% Remove DC
FullChanEst_11(852)=[];
FullChanEst_21(852)=[];
FullChanEst_31(852)=[];
FullChanEst_41(852)=[];
FullChanEst_12(852)=[];
FullChanEst_22(852)=[];
FullChanEst_32(852)=[];
FullChanEst_42(852)=[];
for sym=1:8:2*demparams.sympf % 802.16 - 4 Tx Antenna Scheme, Coding rate=2
% ############ first half (S1, S2, S3, S4) ############
% ------Rx 1 at Symbol 1------
[sym_time, symlen] = fread(ipfid_rx1, 2*2048*(1+demparams.Guard), 'float32');
if symlen~=2*2048*(1+demparams.Guard), error('fread channel output data error!'); end
sym_time = [ 1 1j ] * reshape(sym_time, 2, symlen/2);
symlen=symlen/2;
% remove CP
sym_time=sym_time((2048*demparams.Guard+1):end);
% FFT
sym_freq_R1_S1=fftshift(fft(sym_time,2048)/sqrt(2048)); % Rx 1,Symbol 1
% ##### Trim Guard subcarriers #####
sym_freq_R1_S1(1877:2048)=[]; sym_freq_R1_S1(1:173)=[];
% Remove DC
sym_freq_R1_S1(852)=[];
% ------Rx 1 at Symbol 2------
[sym_time, symlen] = fread(ipfid_rx1, 2*2048*(1+demparams.Guard), 'float32');
if symlen~=2*2048*(1+demparams.Guard), error('fread channel output data error!'); end
sym_time = [ 1 1j ] * reshape(sym_time, 2, symlen/2);
symlen=symlen/2;
% remove CP
sym_time=sym_time((2048*demparams.Guard+1):end);
% FFT
sym_freq_R1_S2=fftshift(fft(sym_time,2048)/sqrt(2048)); % Rx 1,Symbol 2
% ##### Trim Guard subcarriers #####
sym_freq_R1_S2(1877:2048)=[]; sym_freq_R1_S2(1:173)=[];
% Remove DC
sym_freq_R1_S2(852)=[];
% ------Rx 2 at Symbol 1------
[sym_time, symlen] = fread(ipfid_rx2, 2*2048*(1+demparams.Guard), 'float32');
if symlen~=2*2048*(1+demparams.Guard), error('fread channel output data error!'); end
sym_time = [ 1 1j ] * reshape(sym_time, 2, symlen/2);
symlen=symlen/2;
% remove CP
sym_time=sym_time((2048*demparams.Guard+1):end);
% FFT
sym_freq_R2_S1=fftshift(fft(sym_time,2048)/sqrt(2048)); % Rx 2,Symbol 1
% ##### Trim Guard subcarriers #####
sym_freq_R2_S1(1877:2048)=[]; sym_freq_R2_S1(1:173)=[];
% Remove DC
sym_freq_R2_S1(852)=[];
% ------Rx 2 at Symbol 2------
[sym_time, symlen] = fread(ipfid_rx2, 2*2048*(1+demparams.Guard), 'float32');
if symlen~=2*2048*(1+demparams.Guard), error('fread channel output data error!'); end
sym_time = [ 1 1j ] * reshape(sym_time, 2, symlen/2);
symlen=symlen/2;
% remove CP
sym_time=sym_time((2048*demparams.Guard+1):end);
% FFT
sym_freq_R2_S2=fftshift(fft(sym_time,2048)/sqrt(2048)); % Rx 2,Symbol 2
% ##### Trim Guard subcarriers #####
sym_freq_R2_S2(1877:2048)=[]; sym_freq_R2_S2(1:173)=[];
% Remove DC
sym_freq_R2_S2(852)=[];
% ######## ZF IC and Alamouti Detection ########
% [DemapSymbol_1,DemapSymbol_2,DemapSymbol_3,DemapSymbol_4] ...
% =ZeroForcing_IC_mlDetection_4x2(FullChanEst_11,FullChanEst_21,FullChanEst_31,FullChanEst_41, ...
% FullChanEst_12,FullChanEst_22,FullChanEst_32,FullChanEst_42, ...
% sym_freq_R1_S1,sym_freq_R1_S2,sym_freq_R2_S1,sym_freq_R2_S2,demparams.qam);
% ##############################################
% ######## MMSE IC and Maximum Likelihood Detection ########
[DemapSymbol_1,DemapSymbol_2,DemapSymbol_3,DemapSymbol_4] ...
=mmse_IC_mlDetection_4x2(FullChanEst_11,FullChanEst_21,FullChanEst_31,FullChanEst_41, ...
FullChanEst_12,FullChanEst_22,FullChanEst_32,FullChanEst_42, ...
sym_freq_R1_S1,sym_freq_R1_S2,sym_freq_R2_S1,sym_freq_R2_S2,NoisePwr,demparams.qam);
% ##############################################
% compare with original data for SER
suberr=suberr+length(find(orig_DFUSC(sym,:)-DemapSymbol_1)) ...
+length(find(orig_DFUSC(sym+1,:)-DemapSymbol_2)) ...
+length(find(orig_DFUSC(sym+2,:)-DemapSymbol_3)) ...
+length(find(orig_DFUSC(sym+3,:)-DemapSymbol_4));
% ########## second half (S5, S6, S7, S8) ##########
% ------Rx 1 at Symbol 3------
[sym_time, symlen] = fread(ipfid_rx1, 2*2048*(1+demparams.Guard), 'float32');
if symlen~=2*2048*(1+demparams.Guard), error('fread channel output data error!'); end
sym_time = [ 1 1j ] * reshape(sym_time, 2, symlen/2);
symlen=symlen/2;
% remove CP
sym_time=sym_time((2048*demparams.Guard+1):end);
% FFT
sym_freq_R1_S3=fftshift(fft(sym_time,2048)/sqrt(2048)); % Rx 1,Symbol 3
% ##### Trim Guard subcarriers #####
sym_freq_R1_S3(1877:2048)=[]; sym_freq_R1_S3(1:173)=[];
% Remove DC
sym_freq_R1_S3(852)=[];
% ------Rx 1 at Symbol 4------
[sym_time, symlen] = fread(ipfid_rx1, 2*2048*(1+demparams.Guard), 'float32');
if symlen~=2*2048*(1+demparams.Guard), error('fread channel output data error!'); end
sym_time = [ 1 1j ] * reshape(sym_time, 2, symlen/2);
symlen=symlen/2;
% remove CP
sym_time=sym_time((2048*demparams.Guard+1):end);
% FFT
sym_freq_R1_S4=fftshift(fft(sym_time,2048)/sqrt(2048)); % Rx 1,Symbol 4
% ##### Trim Guard subcarriers #####
sym_freq_R1_S4(1877:2048)=[]; sym_freq_R1_S4(1:173)=[];
% Remove DC
sym_freq_R1_S4(852)=[];
% ------Rx 2 at Symbol 3------
[sym_time, symlen] = fread(ipfid_rx2, 2*2048*(1+demparams.Guard), 'float32');
if symlen~=2*2048*(1+demparams.Guard), error('fread channel output data error!'); end
sym_time = [ 1 1j ] * reshape(sym_time, 2, symlen/2);
symlen=symlen/2;
% remove CP
sym_time=sym_time((2048*demparams.Guard+1):end);
% FFT
sym_freq_R2_S3=fftshift(fft(sym_time,2048)/sqrt(2048)); % Rx 2,Symbol 1
% ##### Trim Guard subcarriers #####
sym_freq_R2_S3(1877:2048)=[]; sym_freq_R2_S3(1:173)=[];
% Remove DC
sym_freq_R2_S3(852)=[];
% ------Rx 2 at Symbol 4------
[sym_time, symlen] = fread(ipfid_rx2, 2*2048*(1+demparams.Guard), 'float32');
if symlen~=2*2048*(1+demparams.Guard), error('fread channel output data error!'); end
sym_time = [ 1 1j ] * reshape(sym_time, 2, symlen/2);
symlen=symlen/2;
% remove CP
sym_time=sym_time((2048*demparams.Guard+1):end);
% FFT
sym_freq_R2_S4=fftshift(fft(sym_time,2048)/sqrt(2048)); % Rx 2,Symbol 2
% ##### Trim Guard subcarriers #####
sym_freq_R2_S4(1877:2048)=[]; sym_freq_R2_S4(1:173)=[];
% Remove DC
sym_freq_R2_S4(852)=[];
% ######## ZF IC and Alamouti Detection ########
% [DemapSymbol_5,DemapSymbol_7,DemapSymbol_6,DemapSymbol_8] ...
% =ZeroForcing_IC_mlDetection_4x2(FullChanEst_11,FullChanEst_31,FullChanEst_21,FullChanEst_41, ...
% FullChanEst_12,FullChanEst_32,FullChanEst_22,FullChanEst_42, ...
% sym_freq_R1_S3,sym_freq_R1_S4,sym_freq_R2_S3,sym_freq_R2_S4,demparams.qam);
% ##############################################
% ######## MMSE IC and Maximum Likelihood Detection ########
[DemapSymbol_5,DemapSymbol_7,DemapSymbol_6,DemapSymbol_8] ...
=mmse_IC_mlDetection_4x2(FullChanEst_11,FullChanEst_31,FullChanEst_21,FullChanEst_41, ...
FullChanEst_12,FullChanEst_32,FullChanEst_22,FullChanEst_42, ...
sym_freq_R1_S3,sym_freq_R1_S4,sym_freq_R2_S3,sym_freq_R2_S4,NoisePwr,demparams.qam);
% ##############################################
% compare with original data for SER
suberr=suberr+length(find(orig_DFUSC(sym+4,:)-DemapSymbol_5)) ...
+length(find(orig_DFUSC(sym+5,:)-DemapSymbol_6)) ...
+length(find(orig_DFUSC(sym+6,:)-DemapSymbol_7)) ...
+length(find(orig_DFUSC(sym+7,:)-DemapSymbol_8));
end % end for sym
end % end for frm
ser=suberr/datanum
mse=mse/(8*demparams.numframe)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -